Engine Not Found using Prisma with AWS Lambda.

Hello, I get the error:
"errorType": "PrismaClientInitializationError",
"errorMessage": "\nInvalid `prisma.quiz.findMany()` invocation:\n\n\nPrisma Client could not locate the Query Engine for runtime \"rhel-openssl-3.0.x\".\n\nThis is likely caused by a bundler that has not copied \"libquery_engine-rhel-openssl-3.0.x.so.node\"
"errorType": "PrismaClientInitializationError",
"errorMessage": "\nInvalid `prisma.quiz.findMany()` invocation:\n\n\nPrisma Client could not locate the Query Engine for runtime \"rhel-openssl-3.0.x\".\n\nThis is likely caused by a bundler that has not copied \"libquery_engine-rhel-openssl-3.0.x.so.node\"
I currently us a cdk to bundle the code for my lambda functions.
return {
bundling: {
nodeModules: ['@prisma/client', 'prisma'],
commandHooks: {
beforeBundling(_inputDir: string, _outputDir: string) {
return [];
},
beforeInstall(_inputDir: string, _outputDir: string) {
// Copy the prisma folder to the output directory
return [
`cd ${_inputDir}`,
'cd ../../',
`cp -R ${_inputDir}/prisma ${_outputDir}/`,
];
},
afterBundling(_inputDir: string, _outputDir: string) {
// Generate the Prisma client and remove the prisma folders to decrease the size of the deployment package
return [
`cd ${_outputDir}`,
'npx prisma generate',
`rm -rf ${_outputDir}/node_modules/@prisma/engines`, // Remove the engines folder to decrease the size of the deployment package
`rm -rf ${_outputDir}/node_modules/@prisma/client/node_modules node_modules/.bin node_modules/prisma`,
return {
bundling: {
nodeModules: ['@prisma/client', 'prisma'],
commandHooks: {
beforeBundling(_inputDir: string, _outputDir: string) {
return [];
},
beforeInstall(_inputDir: string, _outputDir: string) {
// Copy the prisma folder to the output directory
return [
`cd ${_inputDir}`,
'cd ../../',
`cp -R ${_inputDir}/prisma ${_outputDir}/`,
];
},
afterBundling(_inputDir: string, _outputDir: string) {
// Generate the Prisma client and remove the prisma folders to decrease the size of the deployment package
return [
`cd ${_outputDir}`,
'npx prisma generate',
`rm -rf ${_outputDir}/node_modules/@prisma/engines`, // Remove the engines folder to decrease the size of the deployment package
`rm -rf ${_outputDir}/node_modules/@prisma/client/node_modules node_modules/.bin node_modules/prisma`,
My engine is not being located in my lambda. I am using NODE.js 20 for my lambda function. I am able to successfully deploy my cdk with the layer but on AWS console, the test file and that is where I get the error. Here is my github to look at the source code: https://github.com/Coltensiemer/AWS_Learn]
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server