P
Prisma5mo ago
Mas0n

Running into a strange issue

→ λ api ── aws:apigateway:v2:post:/createWorkflow
─ Error creating workflow: PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "darwin-arm64".

This is likely caused by a bundler that has not copied "libquery_engine-darwin-arm64.dylib.node" next to the resulting bundle.
Ensure that "libquery_engine-darwin-arm64.dylib.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
→ λ api ── aws:apigateway:v2:post:/createWorkflow
─ Error creating workflow: PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "darwin-arm64".

This is likely caused by a bundler that has not copied "libquery_engine-darwin-arm64.dylib.node" next to the resulting bundle.
Ensure that "libquery_engine-darwin-arm64.dylib.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
18 Replies
Prisma AI Help
Prisma AI Help5mo ago
You selected the carefully hand-crafted route. A dev artisan will respond soon. Meanwhile, the #ask-ai channel awaits if you're curious!
Mas0n
Mas0nOP5mo ago
I ran
serverless dev --stage dev
serverless dev --stage dev
to proxy the endpoint to my localhost. if using serverless overcomplicates things I dont need to use it. Priority is getting this to work.
Nurul
Nurul5mo ago
Hey! Have you added any binaryTargets in the generator in schema.prisma file? Can you share it? The error you are observing seems similar to this one: https://github.com/prisma/prisma/issues/8483
GitHub
Query Engine not found on Serverless App · Issue #8483 · prisma/p...
Bug description I'm building an application using: Serverless Framework + Yarn Workspaces + Serverless Bundle to package the lambdas; I'm having issues with the query engine binary, tried a...
Mas0n
Mas0nOP5mo ago
hey @Nurul (Prisma) aside from my models this is all i have
generator client {
provider = "prisma-client-js"

}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"

}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
would definitely appreciate some help here as its been a blocker for several days : /
Mas0n
Mas0nOP5mo ago
No description
Mas0n
Mas0nOP5mo ago
@Nurul can i please have some help here? Still nothing :/
cesar sampaio
cesar sampaio5mo ago
try adding binaryTargets to your generator client binaryTargets = ["native", "rhel-openssl-1.0.x"]
Mas0n
Mas0nOP5mo ago
i added that unfortunately it didnt fix the issue. @cesar sampaio any other ideas? would really appreciate the help :
Nurul
Nurul5mo ago
Hey @Mas0n Sorry for the delay in getting back to this thread. Can you let me know your Node version? If you are deploying to node version 20+ then, can you try adding rhel-openssl-3.0.x not (rhel-openssl-1.0.x) and check if the issue gets fixed? If you are deploying to arm64 gravitron instances then I would also recommend adding these binary targets.
Mas0n
Mas0nOP5mo ago
no worries thanks for getting back to me. our serverless instance is on node 18 @Nurul
Mas0n
Mas0nOP5mo ago
No description
Nurul
Nurul5mo ago
Ah, okay. Just to confirm, these binary targets also didn’t fix the issue, right? binaryTargets = ["native", "linux-arm64-openssl-1.0.x"]
Mas0n
Mas0nOP5mo ago
let me see. are you able to hop in an offce hours or quick call? I have two outstanding issues think we can fix together @Nurul correct this doesnt work and I am seeing this error:
{
"message": "PrismaClientInitializationError: \nInvalid `prisma.debtor_workflow_status.findMany()` invocation:\n\n\nPrisma Client could not locate the Query Engine for runtime \"rhel-openssl-1.0.x\".\n\nThis happened because Prisma Client was generated for \"debian-openssl-3.0.x\", but the actual deployment required \"rhel-openssl-1.0.x\".\nAdd \"rhel-openssl-1.0.x\" to `binaryTargets` in the \"schema.prisma\" file and run `prisma generate` after saving it:\n\ngenerator client {\n provider = \"prisma-client-js\"\n binaryTargets = [\"native\", \"linux-arm64-openssl-1.0.x\", \"rhel-openssl-1.0.x\"]\n}\n\nThe following locations have been searched:\n /var/task/generated/prisma\n /var\n /home/runner/work/workflow-scheduling/workflow-scheduling/generated/prisma\n /.prisma/client\n /tmp/prisma-engines",
"name": "Runtime.UnhandledPromiseRejection",
"type": "ERROR_TYPE_UNCAUGHT"
}
{
"message": "PrismaClientInitializationError: \nInvalid `prisma.debtor_workflow_status.findMany()` invocation:\n\n\nPrisma Client could not locate the Query Engine for runtime \"rhel-openssl-1.0.x\".\n\nThis happened because Prisma Client was generated for \"debian-openssl-3.0.x\", but the actual deployment required \"rhel-openssl-1.0.x\".\nAdd \"rhel-openssl-1.0.x\" to `binaryTargets` in the \"schema.prisma\" file and run `prisma generate` after saving it:\n\ngenerator client {\n provider = \"prisma-client-js\"\n binaryTargets = [\"native\", \"linux-arm64-openssl-1.0.x\", \"rhel-openssl-1.0.x\"]\n}\n\nThe following locations have been searched:\n /var/task/generated/prisma\n /var\n /home/runner/work/workflow-scheduling/workflow-scheduling/generated/prisma\n /.prisma/client\n /tmp/prisma-engines",
"name": "Runtime.UnhandledPromiseRejection",
"type": "ERROR_TYPE_UNCAUGHT"
}
@Nurul can we jump on a quick call?
Nurul
Nurul5mo ago
It won't be possible for me to jump on a call currently. I'll create a sample prisma app using lambda functions via serverless framework and share it with you by tomorrow. I am not sure what's going wrong currently, so creating a sample app will be helpful in debugging what's going on. Meanwhile, I assume you might have seen these instructions of deploying lambda functions via serverless but sharing it just in case you didn't see it.
Nurul
Nurul5mo ago
Also just found this official example: https://github.com/prisma/deployment-example-lambda-serverless-framework Did you try using this as a reference?
GitHub
GitHub - prisma/deployment-example-lambda-serverless-framework
Contribute to prisma/deployment-example-lambda-serverless-framework development by creating an account on GitHub.
Nurul
Nurul5mo ago
I would recommend following the instructions as it is, and first making it work with the prisma version from example (5.1.1) and once it works, you can upgrade it to prisma 6.0.0 I'll also deploy the same and check if everything works as expected Here's a working example of serverless aws lambda with latest prisma version: https://github.com/nurul3101/prisma-serverless-lambda I hope this would be helpful You can test out the deployed code this way:
curl -X POST \
https://ds54dd41t8.execute-api.us-east-1.amazonaws.com/dev/user \
-H 'Content-Type: application/json' \
-d '{"userId": 1}'
curl -X POST \
https://ds54dd41t8.execute-api.us-east-1.amazonaws.com/dev/user \
-H 'Content-Type: application/json' \
-d '{"userId": 1}'
This example uses Node version 18 as in your stack
Nurul
Nurul5mo ago
No description
Mas0n
Mas0nOP5mo ago
Hey - you're awesome thanks. going to look at this now @Nurul you around by chance? im wondering how you deployed it / the config of your serverless app / instance and how you set .env variables so i can DIFF that
# "org" ensures this Service is used with the correct Serverless Framework Access Key.
org: collectwise
# "app" enables Serverless Framework Dashboard features and sharing them with other Services.
app: workflows
# "service" is the name of this project. This will also be added to your AWS resource names.
service: workflows
useDotenv: true
plugins:
- serverless-dotenv-plugin
provider:
name: aws
runtime: nodejs18.x
stage: ${opt:stage, 'dev'}
environment:
STAGE: ${self:provider.stage}
DATABASE_URL: ${env:DATABASE_URL}
functions:
api:

handler: handler.handler
timeout: 30
name: ${self:service}-${self:provider.stage}-api
events:
- httpApi:
path: "*"
method: "*"

package:
patterns:
- '!node_modules/.prisma/client/libquery_engine-*'
- 'node_modules/.prisma/client/libquery_engine-rhel-*'
- '!node_modules/prisma/libquery_engine-*'
- '!node_modules/@prisma/engines/**'


# Configure observability for different stages
stages:
prod:
observability: true
default:
observability: false

# Optional: Add conditions for environment-specific configurations
resources:
Conditions:
IsProduction:
Fn::Equals:
- ${self:provider.stage}
- "prod"
# "org" ensures this Service is used with the correct Serverless Framework Access Key.
org: collectwise
# "app" enables Serverless Framework Dashboard features and sharing them with other Services.
app: workflows
# "service" is the name of this project. This will also be added to your AWS resource names.
service: workflows
useDotenv: true
plugins:
- serverless-dotenv-plugin
provider:
name: aws
runtime: nodejs18.x
stage: ${opt:stage, 'dev'}
environment:
STAGE: ${self:provider.stage}
DATABASE_URL: ${env:DATABASE_URL}
functions:
api:

handler: handler.handler
timeout: 30
name: ${self:service}-${self:provider.stage}-api
events:
- httpApi:
path: "*"
method: "*"

package:
patterns:
- '!node_modules/.prisma/client/libquery_engine-*'
- 'node_modules/.prisma/client/libquery_engine-rhel-*'
- '!node_modules/prisma/libquery_engine-*'
- '!node_modules/@prisma/engines/**'


# Configure observability for different stages
stages:
prod:
observability: true
default:
observability: false

# Optional: Add conditions for environment-specific configurations
resources:
Conditions:
IsProduction:
Fn::Equals:
- ${self:provider.stage}
- "prod"
@Nurul can you or someone on the team help to debug. this is a business blocker at this point. open to creative solutions. priortity is getting this working

Did you find this page helpful?