Elijah Rosier
11/18/2021, 5:04 PMserverless.yml
package:
individually: true
patterns:
- '!node_modules/@prisma/engines/prisma-fmt-debian-*'
- '!node_modules/@prisma/engines/introspection-engine-*'
- '!node_modules/@prisma/engines/libquery_engine-debian-*'
- '!node_modules/@prisma/engines/migration-engine-*'
- '!node_modules/typescript/**'
- '!node_modules/.prisma/client/query-engine-*'
- '!node_modules/.prisma/client/libquery_engine-*'
- 'node_modules/.prisma/client/libquery_engine-rhel-*'
which correctly keeps only the libquery_engine-rhel-openssl-1.0.x.so.node
binary
# /node_modules/@prisma/engines
total 51M
drwxr-xr-x 4 root root 4.0K Nov 18 16:28 .
drwxr-xr-x 5 root root 4.0K Nov 18 16:28 ..
-rw-r--r-- 1 root root 537 Jan 1 1980 README.md
drwxr-xr-x 2 root root 4.0K Nov 18 16:28 dist
drwxr-xr-x 2 root root 4.0K Nov 18 16:28 download
-rwxr-xr-x 1 root root 42M Jan 1 1980 libquery_engine-rhel-openssl-1.0.x.so.node
-rw-r--r-- 1 root root 774 Jan 1 1980 package.json
-rwxr-xr-x 1 root root 8.6M Jan 1 1980 prisma-fmt-rhel-openssl-1.0.x
However, once deployed and I attempt to access the endpoint I receive the following error in CloudWatch:
ERROR PrismaClientInitializationError:
Invalid `prisma.executeRaw()` invocation:
Query engine library for current platform "rhel-openssl-1.0.x" could not be found.
You incorrectly pinned it to rhel-openssl-1.0.x
This probably happens, because you built Prisma Client on a different platform.
(Prisma Client looked in "/var/task/node_modules/@prisma/client/runtime/libquery_engine-rhel-openssl-1.0.x.so.node")
Searched Locations:
/var/task/node_modules/.prisma/client
/actions-runner/_work/listener-suite/listener-suite/backend/node_modules/@prisma/client
/var/task/node_modules/@prisma/client
/var/task/node_modules/.prisma/client
/var/task/node_modules/.prisma/client
/tmp/prisma-engines
/var/task/node_modules/.prisma/client
To solve this problem, add the platform "rhel-openssl-1.0.x" to the "binaryTargets" attribute in the "generator" block in the "schema.prisma" file:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
}
Then run "prisma generate" for your changes to take effect.
Read more about deploying Prisma Client: <https://pris.ly/d/client-generator>
at cb (/var/task/node_modules/@prisma/client/runtime/index.js:38508:17)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Promise.all (index 0) {
clientVersion: '3.4.2',
errorCode: undefined
}
Is there a way to define the search path, or is there something else I'm doing completely wrong. Apologies for my ignorance, I'm new to using Prisma. Also another note, somehow our zipped lambda is 80MB, even with all of my custom excludes in the serverless.yml
(is this normal with Prisma in AWS?)custom:
webpack:
packager: 'yarn'
includeModules: true
packagerOptions:
scripts:
- prisma generate
- rm -rf node_modules/.prisma/client/libquery_engine-debian-openssl-1.1.x.so.node
- rm -rf node_modules/@prisma/engines
- rm -rf node_modules/@prisma/engines-version
Nima
02/08/2022, 9:30 PM