Nonsense error on correctly structured query
Hi, I got this error in production complaining about values on a list for an "in" filter on a query:
The logged query shows that the query passed has a list of strings and not a list of nulls as suggested by the error message. Has anyone ever stumbled across this before? I'm unable to reproduce, as the same code runs normally.
Bot conversation:
https://discord.com/channels/937751382725886062/1319378542412300348
13 Replies
Hello @Giovani Granzotto 👋
If I understand correctly, you got this error once in your deployed application. And this error doesn't seem to happen in your local environment, correct?
Hi @Nurul . Yes, I got this error on my production deploy. I wasn't able to reproduce it either locally or in the deployed environment, it seemed like a one off or intermittent error, do you have any information on the conditions that could cause it?
I think you can add a condition to filter out nulls to prevent this situation from happening again
Can you examine different parts of your code that populate the sku array? Is there any conditional logic that might lead to null values being included?
Hi @Nurul . This does not work, as a developer added this filter a few days ago when he saw the error and it happened again now.
Also, why would the library log the query with a non null string if it was passed as null?
This is the whole function code. I thought it might have something to do with closures and the strings getting garbage collected or something else low-level like that, but it still doesn't make sense
So even though there is a condition to filter out nulls in the deployed code:
Somehow Null is still being passed to the query? This is strange!
Can you add a log statement just above the query to temporarily debug this?
Something like this:
@Nurul Correct. We've added the log statement you mentioned and it is still erroring out even though we can see in the logs (both our custom log AND prisma's internal validation error log) that the list of arguments does not contain null values.
This is the log I'm seeing on vercel:
log transcript:
This is interesting! 🤔
Do you see any patterns on when this error happens? Is it completely sporadic?
Can you try upgrading to latest prisma version and check?
It happens at only one point in the code, even though similar queries with the in filtering exist elsewhere. There's nothing very remarkable about it.
We might upgrade the prisma client in a future update and will let you know if it continues happening.
@Nurul I'm running prisma 6.2.1 and this is still happening. Any ideas?
Mysteriously, it keeps happening even with
queryRaw
same with query raw unsafe
Nothing comes to my mind as of now. We need a way to reliably reproduce this behaviour in order to debug this 😅