colten909
colten909
Explore posts from servers
PPrisma
Created by colten909 on 9/16/2024 in #help-and-questions
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]
2 replies
TTCTheo's Typesafe Cult
Created by colten909 on 9/20/2023 in #questions
Prisma Seeding
Hello, I am trying to seed my database (supabase) using the 'npx prisma db seed' command. However I keep getting this error: Running seed command ts-node --compiler-options {"module":"CommonJS"} prisma/seed.ts ... TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/folders/project_climb/prisma/seed.ts. I am using the T3 stacks so I have my script written "prisma": { "seed": "ts-node --compiler-options {"module":"CommonJS"} prisma/seed.ts" }, according to the Prisma Docs. Here is my package.json: { "name": "project_climb", "version": "0.1.0", "type": "module", "private": true, "scripts": { "build": "next build", "dev": "next dev", "postinstall": "prisma generate", "lint": "next lint", "start": "next start", "test": "jest", "db-start": "npx supabase start", "db-stop": "npx supabase stop" }, "prisma": { "seed": "ts-node --compiler-options {"module":"CommonJS"} prisma/seed.ts" }, "dependencies": { "@next-auth/prisma-adapter": "^1.0.7", "@prisma/client": "^5.1.1", "@radix-ui/react-slot": "^1.0.2", "@supabase/supabase-js": "^2.33.2", "@t3-oss/env-nextjs": "^0.6.0", "@tanstack/react-query": "^4.29.25", "@trpc/client": "^10.34.0", "@trpc/next": "^10.34.0", "@trpc/react-query": "^10.34.0", "@trpc/server": "^10.34.0", (... cut down for the word count max) }, "devDependencies": { "@types/eslint": "^8.44.2", "@types/node": "^18.17.17", "@types/react": "^18.2.20", "@types/react-dom": "^18.2.7", "@typescript-eslint/eslint-plugin": "^6.3.0", "@typescript-eslint/parser": "^6.3.0", "prisma": "^5.3.1", "supabase": "^1.93.0" "ts-node": "^10.9.1", "typescript": "^5.2.2" }, "ct3aMetadata": { "initVersion": "7.19.0" } }
6 replies