Closed Akumzy closed 4 years ago
Hello! Can you please provide a minimal reproduction for the above crash? Unfortunately the automatically collected information in the issue does not give us much to go with here - we will need a bit more information. What were you doing? Can you share the code and schema that was active?
Also, regarding the max url suggestion, we are in process of improving the automatic error reports and we will definitely consider your suggestion.
Hi @pantharshit00 I was simply using
prisma.$queryRaw<User[]>('SELECT * FROM "User" WHERE "email" ILIKE '%$1%' LIMIT 1', email)
to query which works perfectly using pg Admin but panic using Prisma.
Hey @Akumzy
Thanks for sharing the query. What is the problem here is '%$1%'
is not a postgres string and any postgres variable $1, $2, $3
will not be replaced inside of query.
Since you are passing a variable and prepared statement doesn't expect a variable, it panics and throws the error which prompted you to open this issue.
So in order to perform this query, do something like this:
prisma.$queryRaw<User[]>('SELECT * FROM "User" WHERE "email" ILIKE $1 LIMIT 1', `%${email}%`)
The above query will use postgres replacement and will work.
I will also discuss with the team if we should panic here or we should throw a different error message.
We decided a better error message would indeed be optimal here: https://github.com/prisma/prisma-client-js/issues/883 For now please let us know if using the parameter different, as @pantharshit00 described, solves your problem.
Maybe we can also reflect this in the documentation better.
@janpio it solved the issue. thanks guys.
Hi Prisma Team! My Prisma Client just crashed. This is the report:
Versions
Logs