any simple graphql update fails with this error
[16:50:45] ERROR (payload): TypeError: Cannot read properties of null (reading '_id')
at getLatestCollectionVersion (/home/andre/Documents/qreate-server/qreate-payload/node_modules/payload/src/versions/getLatestCollectionVersion.ts:36:18)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at updateByID (/home/andre/Documents/qreate-server/qreate-payload/node_modules/payload/src/collections/operations/updateByID.ts:111:15)
at resolver (/home/andre/Documents/qreate-server/qreate-payload/node_modules/payload/src/collections/graphql/resolvers/update.ts:38:20)
at handler (/home/andre/Documents/qreate-server/qreate-payload/node_modules/graphql-http/lib/handler.js:283:22)
at requestListener (/home/andre/Documents/qreate-server/qreate-payload/node_modules/graphql-http/lib/use/express.js:27:34)payload version:
"payload": "^1.9.5",graphql query:
mutation UpdatePath($id: String!, $input: mutationPathUpdateInput!) {
updatePath(id: $id, data: $input) {
id
}
}variables:
{
"id": "6491d674bedd83aa362d8585",
"input": {
"title": "updated"
}
}Collection config:
const Paths: CollectionConfig = {
slug: "paths",
versions: false,
access: {
read: (req) => {
return true
},
create: (req) => {
return true;
},
},
fields: [
{
name: "title",
label: "Title",
type: "text",
},
],
};I can create an issue in github if needed.
Hey
@777074739372883968I think it would be helpful if you made an issue as you said.
What happens if you remove
versions: falsefrom your collection config?
It seems that Payload's version logic might be trying to do something somewhere with
versionseven though you're intentionally not using it. Leaving it undefined may just bypass this little bug if it is in fact the problem.
Removing versions still has the same problem. I actually added that to try to debug.
@969226489549713438yeah I’ll create an issue in GitHub
I found the problem. I was passing in the wrong id. maybe there's a better error to show in the console?
Yeah, that error should be different for sure.
Thanks for reporting the issue!
Star
Discord
online
Get dedicated engineering support directly from the Payload team.