Hi there, I am building a serverless application using Prisma on AWS Lambda functions. I based my serverless.com project on the official Lambda example. However, I am experiencing an issue with my Prisma Client invocations. This seems to happen sporadically and without a traceable reason.
Hi Prisma Team! My Prisma Client just crashed. This is the report:
| Name | Version |
|----------|--------------------|
| Node | v12.16.3 |
| OS | rhel-openssl-1.0.x |
| Prisma | 2.2.0 |
2020-07-19T20:01:11.490Z prisma-client {
engineConfig: {
cwd: '/var/task/node_modules/.prisma/client',
debug: false,
datamodelPath: '/var/task/node_modules/.prisma/client/schema.prisma',
prismaPath: undefined,
engineEndpoint: undefined,
generator: {
name: 'client',
provider: 'prisma-client-js',
output: '/Users/alexrv99/Projects/positive-zero/its-covid/its-covid-api/node_modules/@prisma/client',
binaryTargets: [Array],
experimentalFeatures: [Array],
config: {}
},
showColors: false,
logLevel: undefined,
logQueries: undefined,
flags: [],
clientVersion: '2.2.0',
enableExperimental: [ 'aggregations' ]
}
}
2020-07-19T20:01:11.520Z prisma-client Prisma Client call:
2020-07-19T20:01:11.521Z prisma-client prisma.applicant.findOne({
where: {
applicantId: '37525'
}
})
2020-07-19T20:01:11.521Z prisma-client Generated request:
2020-07-19T20:01:11.521Z prisma-client query {
findOneApplicant(where: {
applicantId: "37525"
}) {
id
number
createdAt
updatedAt
careerName
applicantId
cenevalId
fatherLastName
motherLastName
name
email
password
classroom
applicationTime
startTime
}
}
2020-07-19T20:01:11.526Z plusX Execution permissions of /var/task/node_modules/.prisma/client/query-engine-rhel-openssl-1.0.x are fine
2020-07-19T20:01:11.764Z prisma-client Client Version 2.2.0
2020-07-19T20:01:11.764Z prisma-client Engine Version 45c4da4dd3ccd6a322796b228bdf937c7ce884e8
2020-07-19T20:01:20.602Z prisma-client Prisma Client call:
2020-07-19T20:01:20.602Z prisma-client prisma.applicant.findOne({
where: {
applicantId: '37525'
}
})
2020-07-19T20:01:20.602Z prisma-client Generated request:
2020-07-19T20:01:20.602Z prisma-client query {
findOneApplicant(where: {
applicantId: "37525"
}) {
id
number
createdAt
updatedAt
careerName
applicantId
cenevalId
fatherLastName
motherLastName
name
email
password
classroom
applicationTime
startTime
}
}
2020-07-19T20:01:25.698Z prisma-client Prisma Client call:
2020-07-19T20:01:25.698Z prisma-client prisma.applicant.findOne({
where: {
applicantId: ''
}
})
2020-07-19T20:01:25.698Z prisma-client Generated request:
2020-07-19T20:01:25.698Z prisma-client query {
findOneApplicant(where: {
applicantId: ""
}) {
id
number
createdAt
updatedAt
careerName
applicantId
cenevalId
fatherLastName
motherLastName
name
email
password
classroom
applicationTime
startTime
}
}
2020-07-19T20:01:32.005Z prisma-client Prisma Client call:
2020-07-19T20:01:32.005Z prisma-client prisma.applicant.findOne({
where: {
applicantId: '37525'
}
})
2020-07-19T20:01:32.005Z prisma-client Generated request:
2020-07-19T20:01:32.005Z prisma-client query {
findOneApplicant(where: {
applicantId: "37525"
}) {
id
number
createdAt
updatedAt
careerName
applicantId
cenevalId
fatherLastName
motherLastName
name
email
password
classroom
applicationTime
startTime
}
}
2020-07-19T20:01:40.212Z prisma-client Prisma Client call:
2020-07-19T20:01:40.212Z prisma-client prisma.applicant.findOne({
where: {
applicantId: '35635'
}
})
2020-07-19T20:01:40.212Z prisma-client Generated request:
2020-07-19T20:01:40.212Z prisma-client query {
findOneApplicant(where: {
applicantId: "35635"
}) {
id
number
createdAt
updatedAt
careerName
applicantId
cenevalId
fatherLastName
motherLastName
name
email
password
classroom
applicationTime
startTime
}
}
2020-07-19T20:03:41.871Z prisma-client Prisma Client call:
2020-07-19T20:03:41.871Z prisma-client prisma.applicant.findOne({
where: {
applicantId: '36658'
}
})
2020-07-19T20:03:41.871Z prisma-client Generated request:
2020-07-19T20:03:41.871Z prisma-client query {
findOneApplicant(where: {
applicantId: "36658"
}) {
id
number
createdAt
updatedAt
careerName
applicantId
cenevalId
fatherLastName
motherLastName
name
email
password
classroom
applicationTime
startTime
}
}
I was literally just about to post the same issue.
It happens randomly, but usually (just a feeling) around the second or third request when I e.g. query something for 20 times. First one wakes the Lambda and always goes through, second or third one fails sometimes, then the next ones all run fine again. All happening within the same Lambda container, no new invocations (so the function is kept warm all the time). I initialize the Prisma Client outside of the handler function, so it can reuse the db connection. Did not have this issue with Prisma 2.0 I think.
@d2kx I have had the same observations too; it occurs after being idle for some time (about 3 minutes). I'm going to try with 2.0.0.
@d2kx I have had the same observations too; it occurs after being idle for some time (about 3 minutes). I'm going to try with 2.0.0.
I think my issue #791 is related. I could trace the error down to "SocketError: other side closed". I experience the issue already after about 1 min idle.
I didn't see anything specific in the changelog, but since upgrading to Prisma 2.3.0 I haven't seen the error again. Let's hope it sticks.
Hi Prisma Team! My Prisma Client just crashed. This is the report:
| Name | Version |
|----------|--------------------|
| Node | v12.16.3 |
| OS | rhel-openssl-1.0.x |
| Prisma | 2.3.0 |
Started http server
2020-07-21T19:38:22.262Z prisma-client {
engineConfig: {
cwd: '/var/task/prisma',
enableDebugLogs: false,
enableEngineDebugMode: undefined,
datamodelPath: '/var/task/client/schema.prisma',
prismaPath: undefined,
engineEndpoint: undefined,
generator: {
name: 'client',
provider: 'prisma-client-js',
output: '/home/d2kx/projects/regenbogen-backend/functions/prisma-resolver/client',
binaryTargets: [Array],
previewFeatures: [Array],
config: {},
isCustomOutput: true
},
showColors: false,
logLevel: undefined,
logQueries: undefined,
flags: [],
clientVersion: '2.3.0',
enableExperimental: [ 'aggregations' ]
}
}
2020-07-21T19:38:22.435Z plusX Execution permissions of /var/task/client/query-engine-rhel-openssl-1.0.x are fine
2020-07-21T19:38:23.616Z prisma-client Client Version 2.3.0
2020-07-21T19:38:23.616Z prisma-client Engine Version e11114fa1ea826f9e7b4fa1ced34e78892fe8e0e
I can reproduce this with our lambda example(https://github.com/prisma/prisma-examples/tree/master/deployment-platforms/aws-lambda). We are looking into this.
The deployment that I performed: https://hx564z2wo6.execute-api.us-east-1.amazonaws.com/dev/users. It loses connection with the engine after 1min of idealness. The client restarts the engine but the request that was coming in didn't get served.
Another case with details: https://github.com/prisma/prisma-client-js/issues/787#issue-659776828
Is there a workaround or a recent version where this error doesn't show up?
@ubaldin at this moment I'm actually looking into reproduction and fix.
As soon as we have more information, we'll post it here.
We just released a new version: @prisma/[email protected] with a (potential) fix.
With this version, we can't reproduce this problem anymore.
Please let us know, if this fixes it for you :)
Please let us know, if this fixes it for you :)
Hi @timsuchanek, thanks for your effort 馃槂 I implemented @prisma/[email protected] today and it did not crash with my lambda construct anymore, which is very good news. I also have the subjective perception it is also faster now.
Looking forward to release 2.4.0馃
It was fixed for me too 馃憤
Awesome! Thanks for reporting back. I'll close the issue then.
Most helpful comment
I can reproduce this with our lambda example(https://github.com/prisma/prisma-examples/tree/master/deployment-platforms/aws-lambda). We are looking into this.
The deployment that I performed: https://hx564z2wo6.execute-api.us-east-1.amazonaws.com/dev/users. It loses connection with the engine after 1min of idealness. The client restarts the engine but the request that was coming in didn't get served.