#Prisma Optimise and ExecuteRaw

6 messages · Page 1 of 1 (latest)

timber apex
#

I have a raw query that works flawlessly, until I add optimise

    "@neondatabase/serverless": "^1.0.1",
    "@prisma/adapter-neon": "^6.14.0",
    "@prisma/client": "^6.14.0",
    "@prisma/extension-optimize": "^2.0.1",
    "@prisma/instrumentation": "^6.14.0",
...
    "prisma": "^6.14.0",

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 added

little lilyBOT
#

You selected the bot's instantaneous insights. Let me compile your answer right away!

little lilyBOT
# little lily You selected the bot's instantaneous insights. Let me compile your answer right ...

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

timber apex
#

I cant see where it says the stuff your saying?

little lilyBOT