my worker is throwing too many, error 1101.

I am migrating from Lambda, I was using this code

import pg from "pg"
import { Kysely, ParseJSONResultsPlugin, PostgresDialect } from "kysely"

import type { DB } from "../../db/src"

const { Pool } = pg

const globaldb = global as unknown as { db: Kysely<DB> }

export const db =
  globaldb.db ||
  new Kysely<DB>({
    dialect: new PostgresDialect({ pool: new Pool({ connectionString: process.env.DATABASE_URL }) }),
    plugins: [new ParseJSONResultsPlugin()],
  })

if (process.env.NODE_ENV !== "production") {
  globaldb.db = db
}


but in case of my worker, one request works & the other does not, not sure what's wrong here.
Was this page helpful?