Skip to content

[Cloudflare Hyperdrive] PostgresError: prepared statement "o0gtsdfu434" already exists #960

Open
@emerleite

Description

@emerleite

I'm looping over some array items and perform some DB tasks. It's basic Select and Inserts.

Somehow, I receive prepared statment already exists error.

I saw other issues people mentioning something related with pg_bouncer.

Any tips?

async function xpto(items) {
  const sql = postgres(env.DB_SUPABASE.connectionString)
  for (const item of items) {
    await doStuff(item, sql);
  }
}

async function doStuff(item, sql) {
  //Sometimes this and other thows `prepared statment already exists` error
  const checkSomething = await sql`SELECT * FROM table WHERE a_column = ${item.value};`
  if (checkSomething.a_column == 'something') {
     //Finish Work
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions