trigger.dev icon indicating copy to clipboard operation
trigger.dev copied to clipboard

Update the prisma extension to force binaryTarget of debian-openssl-3.0.x

Open ericallam opened this issue 1 year ago • 10 comments

If you see this error:

PrismaClientInitializationError: 
Invalid `prisma.users.findUnique()` invocation:


Prisma Client could not locate the Query Engine for runtime "debian-openssl-3.0.x".

This happened because Prisma Client was generated for "debian-openssl-1.1.x", but the actual deployment required "debian-openssl-3.0.x".
Add "debian-openssl-3.0.x" to `binaryTargets` in the "schema.prisma" file and run `prisma generate` after saving it:

generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "debian-openssl-3.0.x"]
}

The following locations have been searched:
  /app/node_modules/.prisma/client
  /

You can fix it yourself by adding "native", "debian-openssl-3.0.x" to your binaryTargets array, like it says in the error above. Prisma allows generating many targets so this shouldn't impact your existing app that uses Prisma, it just means that Trigger.dev can also work.

Prisma extension

We need to investigate whether we can solve this automatically without requiring any changes to the prisma schema file, by adding some code to our prisma extension somehow.

ericallam avatar Sep 26 '24 08:09 ericallam

Also seeing this on 3.0.9. Worked fine on 56 beta:

◇  Failed to deploy project
│
■  Error: PrismaClientInitializationError
│  
│         PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "debian-openssl-3.0.x".
│         
│         This happened because Prisma Client was generated for "darwin-arm64", but the actual deployment required "debian-openssl-3.0.x".
│         Add "debian-openssl-3.0.x" to `binaryTargets` in the "schema.prisma" file and run `prisma generate` after saving it:
│         
│         generator client {
│           provider      = "prisma-client-js"
│           binaryTargets = ["native", "debian-openssl-3.0.x"]
│         }

elie222 avatar Oct 01 '24 23:10 elie222

Adding binaryTargets = ["native", "debian-openssl-3.0.x"] and running prisma generate results in this error:

Error: PrismaClientInitializationError
│  
│         PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "debian-openssl-3.0.x".
│         
│         This is likely caused by a bundler that has not copied "libquery_engine-debian-openssl-3.0.x.so.node" next to the resulting bundle.
│         Ensure that "libquery_engine-debian-openssl-3.0.x.so.node" has been copied next to the bundle or in "../node_modules/.pnpm/@[email protected][email protected]/node_modules/.prisma/client".
│         
│         We would appreciate if you could take the time to share some information with us.
│         Please help us by answering a few questions: https://pris.ly/engine-not-found-bundler-investigation
│         
│         The following locations have been searched:

Reverting my Trigger package update for now.

elie222 avatar Oct 01 '24 23:10 elie222

Can confirm that reverting to 3.0.0-beta.56 fixes the issues.

elie222 avatar Oct 01 '24 23:10 elie222

I'm using a Turborepo btw. prisma is installed in the web app where I'm trying to run trigger deploy

elie222 avatar Oct 01 '24 23:10 elie222

@elie222 did you use the prisma extension when using 3.0.9?

ericallam avatar Oct 02 '24 00:10 ericallam

@elie222 did you use the prisma extension when using 3.0.9?

Didn't try it. Will try tomorrow. Thanks!

elie222 avatar Oct 02 '24 02:10 elie222

Tried the prisma extension on 3.1.2 and still seeing the issue

CloudCodesStuff avatar Nov 11 '24 05:11 CloudCodesStuff

Just ran into this issue again on 3.3.3, but I can confirm that using the Prisma extension fixed it for me.

elie222 avatar Dec 03 '24 09:12 elie222

I get this error too Edit: This help me fix it: https://trigger.dev/docs/config/config-file#prisma

Failed to deploy project
│
■  Error: PrismaClientInitializationError
│
│         PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "debian-openssl-3.0.x".
│
│         This is likely caused by a bundler that has not copied "libquery_engine-debian-openssl-3.0.x.so.node" next to the resulting bundle.
│         Ensure that "libquery_engine-debian-openssl-3.0.x.so.node" has been copied next to the bundle or in "node_modules/.prisma/client".
│
│         We would appreciate if you could take the time to share some information with us.
│         Please help us by answering a few questions: https://pris.ly/engine-not-found-bundler-investigation
│
│         The following locations have been searched:
│           /app/node_modules/.prisma/client
│           /
│           D:\Job\node_modules\@prisma\client
│           /.prisma/client
│           /tmp/prisma-engines
│             at Ja (file:///node_modules/@prisma/client/runtime/library.js:64:805)
│             at Object.loadLibrary (file:///node_modules/@prisma/client/runtime/library.js:111:8993)
│             at kr.loadEngine (file:///node_modules/@prisma/client/runtime/library.js:112:448)
│             at kr.instantiateLibrary (file:///node_modules/@prisma/client/runtime/library.js:111:11508)

IRediTOTO avatar Dec 07 '24 21:12 IRediTOTO

I has a similar issue:

PrismaClientInitializationError: 
Invalid `prisma.$queryRaw()` invocation:


Prisma Client could not locate the Query Engine for runtime "debian-openssl-3.0.x".

This is likely caused by a bundler that has not copied "libquery_engine-debian-openssl-3.0.x.so.node" next to the resulting bundle.
Ensure that "libquery_engine-debian-openssl-3.0.x.so.node" has been copied next to the bundle or in "node_modules/.prisma/client".

We would appreciate if you could take the time to share some information with us.
Please help us by answering a few questions: https://pris.ly/engine-not-found-bundler-investigation

The following locations have been searched:
  /app/node_modules/.prisma/client
  /
  /Users/janbarasek/Sites/localhost/baraja/brj-react/node_modules/@prisma/client
  /.prisma/client
  /tmp/prisma-engines
    at _n.handleRequestError (file:///node_modules/@prisma/client/runtime/library.js:122:7227)
    at _n.handleAndLogRequestError (file:///node_modules/@prisma/client/runtime/library.js:122:6235)
    at _n.request (file:///node_modules/@prisma/client/runtime/library.js:122:5919)
    at l (file:///node_modules/@prisma/client/runtime/library.js:131:9116)
    at run (file:///src/trigger/runEmailerDaemon.ts:22:21)
    at file:///.npm/_npx/f51a09bd0abf5f10/node_modules/@trigger.dev/core/src/v3/workers/taskExecutor.ts:125:28
    at ConsoleInterceptor.intercept (file:///.npm/_npx/f51a09bd0abf5f10/node_modules/@trigger.dev/core/src/v3/consoleInterceptor.ts:36:14)
    at result._tracer.startActiveSpan.kind (file:///.npm/_npx/f51a09bd0abf5f10/node_modules/@trigger.dev/core/src/v3/workers/taskExecutor.ts:89:16)
    at file:///.npm/_npx/f51a09bd0abf5f10/node_modules/@trigger.dev/core/src/v3/tracer.ts:107:18
    at TaskExecutor.execute (file:///.npm/_npx/f51a09bd0abf5f10/node_modules/@trigger.dev/core/src/v3/workers/taskExecutor.ts:86:20)

And solution is add a Prisma extension to trigger.config.ts like this:

import { prismaExtension } from '@trigger.dev/build/extensions/prisma';

export default defineConfig({
  build: {
    extensions: [prismaExtension({ schema: 'prisma/schema.prisma' })],
  },
});

janbarasek avatar Dec 16 '24 21:12 janbarasek