Next.js Discord

Discord Forum

Nextjs project on vercel using vercel postgres database failing to make requests

Unanswered
Alligator mississippiensis posted this in #help-forum
Open in Discord
Avatar
Alligator mississippiensisOP
errors am receiving:
PrismaClientUnknownRequestError: 
Invalid `prisma.user.create()` invocation:

Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E42P05), message: "prepared statement \"s0\" already exists", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("prepare.c"), line: Some(412), routine: Some("StorePreparedStatement") }) }), transient: false })
    at Rn.handleRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:174:7499)
    at Rn.handleAndLogRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:174:6754)
    at Rn.request (/var/task/node_modules/@prisma/client/runtime/library.js:174:6344)
    at async handler (/var/task/.next/server/pages/api/users/register.js:75:13) {
  clientVersion: '4.16.2'
}

try {
    const { email, username, password } = result;

    const hashedPassword = await hashPwd(password);
    const user = await prisma.user.create({
        data: {
          email,
          username,
          password: hashedPassword,
        },
      });
      return res.status(200).json({ msg: "User created" });

} catch(error) {
      return res.status(500).json({ error: "An error occured" });

}


This only triggers in production, everything works fine in developement.
I read somewhere the error could because of ssl or something to do with database connection.

0 Replies