Why always encounter this error after few mins
Due to this im not able to able to work properly...
PrismaClientUnknownRequestError: \nInvalid
prisma.users.findUnique()
invocation:\n\n\nError occurred during query execution:\nConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: "42P05", message: "prepared statement \"s4\" already exists", severity: "ERROR", detail: None, column: None, hint: None }), transient: false })5 Replies
Hi @Pradhumansinh Padhiyar 👋
Can you please share the relavant part of your schema? Are you using
pgbouncer
in your connection string? Which database are you using What does your connection string look like?Yes i have pgbouncer in DB URL. Im using Supabase for DB..
Connection String:- postgresql://postgres.awdzhicwvjfxpysuddsanj:[YOUR-PASSWORD]@aws-0-ap-south-1.pooler.supabase.com:6543/postgres?pgbouncer=true
Code:-
const userID = await prisma.users.findUnique({
where:{username:username},
select:{
id:true
}
});
if (!userID) {
return {status:404, data:
} const userHashnodeLink = await prisma.user_hashnode_links.findFirst({ where:{userid: userID?.id}, select:{url:true} }); if (!userHashnodeLink) { return {status:404, data:
User with username ${username} not found
}
} const userHashnodeLink = await prisma.user_hashnode_links.findFirst({ where:{userid: userID?.id}, select:{url:true} }); if (!userHashnodeLink) { return {status:404, data:
Hashnode link not found for user ${username}
}
}
const userHashnodeTheme = await prisma.user_themes.findFirst({
where:{userid: userID?.id},
select:{themeid:true}
});
if (!userHashnodeTheme) {
return {status:404, data:Hashnode Custom Theme not found for user ${username}
}
}
await fetch(${hashnodeAPIURL}
, {
method: 'POST',
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
query: FreeTheme,
variables: { host: userHashnodeLink?.url }
})
}).then(res => res.json()).then(json => blogContentFromHashnode = json)
console.log("Length ==> ",blogContentFromHashnode.data.publication.posts.edges.length);
return {status:200, themeID:userHashnodeTheme.themeid, blogData:blogContentFromHashnode.data, totalCount:blogContentFromHashnode.data.publication.posts.edges.length };
@RaphaelEtimI'm taking a look
Can you please try restarting your Supabase project as suggested here to see if the issue goes away?
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...
Yes i did, but after sometime same error will come again