Prisma/tRPC query failing 1/2 the time, but only in Prod

So I have an app, in my local dev environment, everything is working as expected in regards to the DB, I do a fetch to my dev DB and I get the data back as expected every time. I just deployed to Vercel, connected to the prod DB(hosted by Supabase), and 1/3 of the time the fetches work fine, 2/3 of the time I'm getting an error from Prisma that the fetch(s) couldn't be completed, "error occurred during query execution". Trying to think about how to approach diagnosing this since I can't reproduce in dev. Any help is appreciated!
No description
Solution:
GitHub
prepared statement "s0" already exists · Issue #11643 · prisma/pr...
Bug description I'm connecting to Supabase with their connection pooling enabled and I'm seeing the following 500 errors after multiple refreshes of the same page, until eventually it force...
Jump to solution
9 Replies
Ben
BenOP•8mo ago
This is one of the other errors that comes back for w/e reason, not sure this is any more helpful than the first one 😅
No description
Neto
Neto•8mo ago
Can you show the complete error log?
Ben
BenOP•8mo ago
{
"result": {
"meta": {
"response": {}
},
"shape": {
"message": "\nInvalid `prisma.customer.findMany()` invocation:\n\n\nError occurred during query execution:\nConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: \"42P05\", message: \"prepared statement \\\"s0\\\" already exists\", severity: \"ERROR\", detail: None, column: None, hint: None }), transient: false })",
"code": -32603,
"data": {
"code": "INTERNAL_SERVER_ERROR",
"httpStatus": 500,
"path": "customer.getAll",
"zodError": null
}
},
"data": {
"code": "INTERNAL_SERVER_ERROR",
"httpStatus": 500,
"path": "customer.getAll",
"zodError": null
},
"name": "TRPCClientError"
},
"elapsedMs": 2269,
"context": {}
}
{
"result": {
"meta": {
"response": {}
},
"shape": {
"message": "\nInvalid `prisma.customer.findMany()` invocation:\n\n\nError occurred during query execution:\nConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: \"42P05\", message: \"prepared statement \\\"s0\\\" already exists\", severity: \"ERROR\", detail: None, column: None, hint: None }), transient: false })",
"code": -32603,
"data": {
"code": "INTERNAL_SERVER_ERROR",
"httpStatus": 500,
"path": "customer.getAll",
"zodError": null
}
},
"data": {
"code": "INTERNAL_SERVER_ERROR",
"httpStatus": 500,
"path": "customer.getAll",
"zodError": null
},
"name": "TRPCClientError"
},
"elapsedMs": 2269,
"context": {}
}
Solution
Neto
Neto•8mo ago
GitHub
prepared statement "s0" already exists · Issue #11643 · prisma/pr...
Bug description I'm connecting to Supabase with their connection pooling enabled and I'm seeing the following 500 errors after multiple refreshes of the same page, until eventually it force...
Neto
Neto•8mo ago
looks like is the same issue
Ben
BenOP•8mo ago
You're a legend
Neto
Neto•8mo ago
:PotBased:
Ben
BenOP•8mo ago
It's so dumb, in Supabase's Prisma docs, they talk about adding the ?pgbouncer=true&connection_limit=1 but in their Dashboard, when you click the connect button and copy the .env variables they auto generate, it does not include the pgbouncer querry param. Sigh. Gonna report that bug now, thanks nyx
Neto
Neto•8mo ago
glad that fixed the issue
Want results from more Discord servers?
Add your server