Debugging Invalid `prisma.$queryRaw()` invocation
I am getting an Invalid
prisma.$queryRaw() invocation error when running my code in the cloud (specifically trigger.dev). I have a fairly distinct setup in that I have multiple packages abstracting different Prisma schemas in my monorepo. They are all getting bundled together for Trigger with some bespoke code to copy the binary combined with the prisma extension.
Example snippet from the schemas, which are all configured roughly the same way.
How can I get more information about why the query is failing? I can't really trace any more information about the error, except that I see an ECONNREFUSED in the error in the Trigger console.
My query works fine on my laptop, but is broken in Trigger, so it could be the specific setup I have in place breaks specifically queryRaw, but works for ORM queries. How could I get more information on what is going wrong with this?Trigger.dev
Welcome to the Trigger.dev docs - Trigger.dev
Find all the resources and guides you need to get started
4 Replies
You selected the carefully hand-crafted route. A dev artisan will respond soon. Meanwhile, the
#ask-ai channel awaits if you're curious!Can you share the full error message you are getting?
Can you set DEBUG env variable and see if you get more information?
https://www.prisma.io/docs/orm/prisma-client/debugging-and-troubleshooting/debugging
Debugging (Reference) | Prisma Documentation
This page explains how to enable debugging output for Prisma Client by setting the
DEBUG environment variable.That's most of the useful information in the error. This is the error object with the app portion of the stack trace removed:
I am wondering if
libquery_engine-debian-openssl-3.0.x.so.node does not handle my embeddings the same way as the libquery_engine-darwin-arm64.dylib.node which runs locally
I am including something like this in my query:
Actually, I figured it out. It turns out that in my cloud environment, I was providing the wrong environment variable for the database URL because I have an abstraction locally which renames them.
It's kind of surprising that the driver doesn't have a clearer error when the database URL is missing entirely—Prisma could definitely have better error messagingI am glad to hear that you were able to figure it out!
Thanks for the feedback about nicer error message 🙏