Yoni
Yoni
PPrisma
Created by Yoni on 10/15/2024 in #help-and-questions
Error handling
From Docs: P2001 "The record searched for in the where condition ({model_name}.{argument_name} = {argument_value}) does not exist" this part of the documentation mentions that this error will be thrown when the record in the "where" clause is not found. I'm performing an update, however when the record is not found it just returns null without actually returning an error. I would expect the ORM to return error P2001... Any help would be greatly appreciated!
3 replies
PPrisma
Created by Yoni on 9/30/2024 in #help-and-questions
AWS SAM + Lambda not bundling properly.
Hi guys. I'm writing an AWS SAM template in which I am setting up Prisma with my Lambda functions to interact with my RDS Postgres DB. I am facing an error that I suspect might be related to the query engine and prisma.schema not being bundled with the code. The error I am getting is:
Prisma Client could not locate the Query Engine for runtime \"rhel-openssl-3.0.x\".

This is likely caused by a bundler that has not copied \"libquery_engine-rhel-openssl-3.0.x.so.node\" next to the resulting bundle. Ensure that \"libquery_engine-rhel-openssl-3.0.x.so.node\" has been copied next to the bundle or in \"../../node_modules/.prisma/client\".
Prisma Client could not locate the Query Engine for runtime \"rhel-openssl-3.0.x\".

This is likely caused by a bundler that has not copied \"libquery_engine-rhel-openssl-3.0.x.so.node\" next to the resulting bundle. Ensure that \"libquery_engine-rhel-openssl-3.0.x.so.node\" has been copied next to the bundle or in \"../../node_modules/.prisma/client\".
Clearly theres an issue with the client being generated for my local machine rather than the lambda. I even tried this in my prisma client instatiation but no luck:
import schema from './prisma/schema.prisma'
import x from './node_modules/.prisma/client/libquery_engine-rhel-openssl-1.0.x.so.node'

if (process.env.NODE_ENV !== 'production') {
console.debug(schema, x)
}
import schema from './prisma/schema.prisma'
import x from './node_modules/.prisma/client/libquery_engine-rhel-openssl-1.0.x.so.node'

if (process.env.NODE_ENV !== 'production') {
console.debug(schema, x)
}
I also tried setting this in the lambda's environment variables: PRISMA_QUERY_ENGINE_LIBRARY: /opt/nodejs/node_modules/.prisma/client/libquery_engine-rhel-openssl-1.0.x.so.node (Deps in layers) Any help would be appreciated. Cheers!
2 replies