PrismaP
Prisma7mo ago
8 replies
qoouep

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.
datasource db {
  provider     = "postgresql"
  url          = env("DB_URL")
  directUrl    = env("DIRECT_DB_URL")
  relationMode = "foreignKeys"
  extensions   = [vector]
}

generator client {
  provider        = "prisma-client"
  previewFeatures = ["relationJoins", "postgresqlExtensions", "typedSql", "queryCompiler", "driverAdapters"]
  output          = "../__generated__/prisma"
  engineType      = "library"
}


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
Find all the resources and guides you need to get started
Welcome to the Trigger.dev docs - Trigger.dev
Was this page helpful?