Prisma Optimise and ExecuteRaw
I have a raw query that works flawlessly, until I add optimise
Basically it no longer accepts
Prisma.sql and only a string. I dont want a string and I cant understand why it breaks it, i get the error 'Argument query is missing.'
I was using drive adapters but ive removed them for testing with optimise and I still get the issue.
To be clear this works flawlessly without optimise added4 Replies
You selected the bot's instantaneous insights. Let me compile your answer right away!
When using Prisma Optimize, you may encounter issues with $executeRaw and $queryRaw, especially regarding how queries are passed. Normally, $executeRaw supports both tagged template literals (e.g., prisma.$executeRaw
...) and Prisma.sql objects. However, some users have reported that after adding the Optimize extension, $executeRaw no longer accepts Prisma.sql and only works with a string, resulting in errors like Argument query is missing.
This appears to be a compatibility issue introduced by the Optimize extension. The official documentation and user reports confirm that Optimize is intended for local development and may not be fully compatible with all Prisma features or driver adapters. In fact, one user noted that removing the Optimize extension resolved similar issues, and maintainers clarified that Optimize is not meant for production or all environments yet. Additionally, Optimize is not yet compatible with driver adapters, and the recommended workaround is to run queries locally with the regular Prisma Client and Optimize for inspection and improvement of query performance. This limitation is documented as a known issue with Prisma OptimizeKnown limitations about Prisma Optimize.
If you need to use $executeRaw with Prisma.sql, you may need to temporarily remove the Optimize extension or avoid using it in environments where this compatibility is required. There is currently no documented fix for this specific issue, and the knowledge sources do not provide a workaround that allows both Optimize and Prisma.sql with $executeRaw to work together seamlessly.
In summary: This is a known limitation with Prisma Optimize, and the recommended approach is to use Optimize only in local development and avoid it if you require full $executeRaw/Prisma.sql compatibilityKnown limitations about Prisma Optimize Prisma + Next.js (App Router) on Vercel wit
h Prisma Postgres.I cant see where it says the stuff your saying?
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
Does this happen in latest prisma version - 6.19.0?