Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
fix(next): unhandled error in renderListView server function when no user present (#14878)
Previously, the following error may be thrown when no `user` is present
on the `req`:
```ts
TypeError: Cannot read properties of null (reading 'collection')
at renderListHandler (packages/next/src/views/List/handleServerFunction.tsx:66:28)
at async Server.<anonymous> (test/dev.ts:129:5)
64 | {
65 | 'user.relationTo': {
> 66 | equals: user.collection,
| ^
67 | },
68 | },
69 | { {
digest: '4059983158'
}
POST /admin/collections/with-list-drawer 500 in 164ms (compile: 2ms, render: 162ms)
```
I'm seeing it thrown a lot in our test suites, likely because it's
logging out the user while a previous request is still going on.
This PR explicitly throws an `UnauthorizedError` before the server
function tries to access properties on the `user` object. A
Alessio Gravili committed
10a8f0f60da402ab82d9a240cdf3207865ff7776
Parent: c9a8aa0
Committed by GitHub <noreply@github.com>
on 12/10/2025, 5:07:54 PM