Misleading error message: ERR_INVALID_ARG_TYPE

So i was trying to use raw sql but i forgot to account for @map values in my prisma schema so i was trying to update a column with the model name instead of the map name which i should have used in raw sql. However i ran into very weird error. The query itself was pretty simple:
await prisma.$executeRaw`
UPDATE "users"
SET "pending_actions" = array_remove(pending_actions, ${action})
WHERE id = ${userId}
`;
await prisma.$executeRaw`
UPDATE "users"
SET "pending_actions" = array_remove(pending_actions, ${action})
WHERE id = ${userId}
`;
however the error response i got was:
[TypeError: The "payload" argument must be of type object. Received null] {
code: 'ERR_INVALID_ARG_TYPE'
}
⨯ unhandledRejection: [TypeError: The "payload" argument must be of type object. Received null] {
code: 'ERR_INVALID_ARG_TYPE'
}
⨯ unhandledRejection: [TypeError: The "payload" argument must be of type object. Received null] {
code: 'ERR_INVALID_ARG_TYPE'
}
[TypeError: The "payload" argument must be of type object. Received null] {
code: 'ERR_INVALID_ARG_TYPE'
}
⨯ unhandledRejection: [TypeError: The "payload" argument must be of type object. Received null] {
code: 'ERR_INVALID_ARG_TYPE'
}
⨯ unhandledRejection: [TypeError: The "payload" argument must be of type object. Received null] {
code: 'ERR_INVALID_ARG_TYPE'
}
If you try to access a column in SQL IDE that doesn't exist, you get a simple error SQL Error [42703]: ERROR: column "testing" does not exist. I would have expected a similar error message to that if you're trying to update a table/user that doesn't exist. I solved the problem by modifying the table/col names to correct ones but it took me a while to notice that due to the error message implying that the variables i'm trying to pass down were null/undefined which was misleading. I don't really have a question since i solved the issues other than if it's intended or is this something that you'd need to update/fix or did i miss something?
2 Replies
Prisma AI Help
You selected the carefully hand-crafted route. A dev artisan will respond soon. Meanwhile, the #ask-ai channel awaits if you're curious!
RaphaelEtim
RaphaelEtim5d ago
Hi @King Alastor Thanks for pointing this out. Could you please open an issue on Github so that our team can take a look at improving this?

Did you find this page helpful?