Prisma not working with connection pools
See original GitHub issueBug description
Hi there, I was following this tutorial for integrating connection pooling with Prisma. Unfortunately, when I change my DATABASE_URL
to the pool Prisma starts giving me ConnectorErrors. It’s very strange because it seems to work for a few queries at first, then after about 10-30s it just gives up.
PrismaClientUnknownRequestError:
Invalid `prisma.transactions.findFirst()` 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("26000"), message: "prepared statement \"s13\" does not exist", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("prepare.c"), line: Some(490), routine: Some("FetchPreparedStatement") }) }) })
at cb (/Users/blakebrown/Documents/Code/wagmi/node_modules/@prisma/client/runtime/index.js:38739:17)
at async handler (webpack-internal:///./pages/api/transaction/[asset].js:22:23)
at async apiResolver (/Users/blakebrown/Documents/Code/wagmi/node_modules/next/dist/next-server/server/api-utils.js:8:1)
at async DevServer.handleApiRequest (/Users/blakebrown/Documents/Code/wagmi/node_modules/next/dist/next-server/server/next-server.js:48:397)
at async Object.fn (/Users/blakebrown/Documents/Code/wagmi/node_modules/next/dist/next-server/server/next-server.js:40:176)
at async Router.execute (/Users/blakebrown/Documents/Code/wagmi/node_modules/next/dist/next-server/server/router.js:23:67)
at async DevServer.run (/Users/blakebrown/Documents/Code/wagmi/node_modules/next/dist/next-server/server/next-server.js:49:656)
at async DevServer.handleRequest (/Users/blakebrown/Documents/Code/wagmi/node_modules/next/dist/next-server/server/next-server.js:20:388) {
clientVersion: '3.2.1'
}
How to reproduce
Follow the Youtube tutorial for integrating prisma + vercel + digital ocean connection pools. Switch the DB_URL to the pool connection string. Observe failures after a few initial queries.
Expected behavior
Should be able to query with prisma using a connection pool db url
Prisma information
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model spacebudz {
id Int @id(map: "spacebudz_pkey1") @default(autoincrement())
asset String @unique
policy_id String?
asset_name String?
name String?
image String?
Type String?
Axe Boolean? @default(false)
Belt Boolean? @default(false)
Chestplate Boolean? @default(false)
Covered_Helmet Boolean? @default(false) @map("Covered Helmet")
Star_Suit Boolean? @default(false) @map("Star Suit")
Camo_Suit Boolean? @default(false) @map("Camo Suit")
Watch Boolean? @default(false)
Wool_Boots Boolean? @default(false) @map("Wool Boots")
Special_Background Boolean? @default(false) @map("Special Background")
Amulet Boolean? @default(false)
VR Boolean? @default(false)
Ski_Goggles Boolean? @default(false) @map("Ski Goggles")
Eye_Patch Boolean? @default(false) @map("Eye Patch")
Snorkel Boolean? @default(false)
X_Ray Boolean? @default(false) @map("X-Ray")
Sword Boolean? @default(false)
Sun_Glasses Boolean? @default(false) @map("Sun Glasses")
Revolver Boolean? @default(false)
Jetpack Boolean? @default(false)
Backpack Boolean? @default(false)
Pistol Boolean? @default(false)
Umbrella Boolean? @default(false)
Flag Boolean? @default(false)
Cardano Boolean? @default(false)
Flowers Boolean? @default(false)
Harpoon Boolean? @default(false)
Hockey_Stick Boolean? @default(false) @map("Hockey Stick")
Bazooka Boolean? @default(false)
Anchor Boolean? @default(false)
Arc Boolean? @default(false)
Wine Boolean? @default(false)
Jo_Jo Boolean? @default(false) @map("Jo-Jo")
Blaster Boolean? @default(false)
Lamp_Fish Boolean? @default(false) @map("Lamp Fish")
Baguette Boolean? @default(false)
Candle Boolean? @default(false)
Binoculars Boolean? @default(false)
SPO Boolean? @default(false)
Type_Rarity Float? @map("Type Rarity") @db.Real
Axe_Rarity Float? @map("Axe Rarity") @db.Real
VR_Rarity Float? @map("VR Rarity") @db.Real
Amulet_Rarity Float? @map("Amulet Rarity") @db.Real
Eye_Patch_Rarity Float? @map("Eye Patch Rarity") @db.Real
Snorkel_Rarity Float? @map("Snorkel Rarity") @db.Real
Ski_Goggles_Rarity Float? @map("Ski Goggles Rarity") @db.Real
X_Ray_Rarity Float? @map("X-Ray Rarity") @db.Real
Special_Background_Rarity Float? @map("Special Background Rarity") @db.Real
Watch_Rarity Float? @map("Watch Rarity") @db.Real
Chestplate_Rarity Float? @map("Chestplate Rarity") @db.Real
Star_Suit_Rarity Float? @map("Star Suit Rarity") @db.Real
Belt_Rarity Float? @map("Belt Rarity") @db.Real
Camo_Suit_Rarity Float? @map("Camo Suit Rarity") @db.Real
Covered_Helmet_Rarity Float? @map("Covered Helmet Rarity") @db.Real
Sword_Rarity Float? @map("Sword Rarity") @db.Real
Wool_Boots_Rarity Float? @map("Wool Boots Rarity") @db.Real
Revolver_Rarity Float? @map("Revolver Rarity") @db.Real
Pistol_Rarity Float? @map("Pistol Rarity") @db.Real
Sun_Glasses_Rarity Float? @map("Sun Glasses Rarity") @db.Real
Flag_Rarity Float? @map("Flag Rarity") @db.Real
Backpack_Rarity Float? @map("Backpack Rarity") @db.Real
Umbrella_Rarity Float? @map("Umbrella Rarity") @db.Real
Jetpack_Rarity Float? @map("Jetpack Rarity") @db.Real
Flowers_Rarity Float? @map("Flowers Rarity") @db.Real
Harpoon_Rarity Float? @map("Harpoon Rarity") @db.Real
Cardano_Rarity Float? @map("Cardano Rarity") @db.Real
Hockey_Stick_Rarity Float? @map("Hockey Stick Rarity") @db.Real
Bazooka_Rarity Float? @map("Bazooka Rarity") @db.Real
Blaster_Rarity Float? @map("Blaster Rarity") @db.Real
Wine_Rarity Float? @map("Wine Rarity") @db.Real
Jo_Jo_Rarity Float? @map("Jo-Jo Rarity") @db.Real
Candle_Rarity Float? @map("Candle Rarity") @db.Real
Anchor_Rarity Float? @map("Anchor Rarity") @db.Real
Arc_Rarity Float? @map("Arc Rarity") @db.Real
Lamp_Fish_Rarity Float? @map("Lamp Fish Rarity") @db.Real
Baguette_Rarity Float? @map("Baguette Rarity") @db.Real
SPO_Rarity Float? @map("SPO Rarity") @db.Real
Binoculars_Rarity Float? @map("Binoculars Rarity") @db.Real
price_lovelace BigInt?
}
model collections {
name String @id
policy_id String @unique
items Int?
owners Int?
floor_lovelace BigInt?
volume_lovelace BigInt?
display_name String?
description String?
twitter_link String?
discord_link String?
website_link String?
telegram_link String?
instagram_link String?
medium_link String?
last_updated String?
attributes_title String? @default("Attributes")
}
model adaninjaz {
id Int @id @default(autoincrement())
asset String @unique
policy_id String?
asset_name String?
image String?
Version String?
name String?
Body String?
Eyes String?
Hair String?
Mask String?
Scar String?
Mouth String?
Glasses String?
Weapons String?
Clothing String?
Earrings String?
Nosering String?
Companion String?
Background String?
Facial_Hair String? @map("Facial Hair")
Hoskinanium String?
Version_Rarity Float? @map("Version Rarity") @db.Real
Earrings_Rarity Float? @map("Earrings Rarity") @db.Real
Nosering_Rarity Float? @map("Nosering Rarity") @db.Real
Companion_Rarity Float? @map("Companion Rarity") @db.Real
Background_Rarity Float? @map("Background Rarity") @db.Real
Facial_Hair_Rarity Float? @map("Facial Hair Rarity") @db.Real
Hoskinanium_Rarity Float? @map("Hoskinanium Rarity") @db.Real
Body_Rarity Float? @map("Body Rarity") @db.Real
Hair_Rarity Float? @map("Hair Rarity") @db.Real
Eyes_Rarity Float? @map("Eyes Rarity") @db.Real
Glasses_Rarity Float? @map("Glasses Rarity") @db.Real
Mouth_Rarity Float? @map("Mouth Rarity") @db.Real
Mask_Rarity Float? @map("Mask Rarity") @db.Real
Clothing_Rarity Float? @map("Clothing Rarity") @db.Real
Weapons_Rarity Float? @map("Weapons Rarity") @db.Real
Scar_Rarity Float? @map("Scar Rarity") @db.Real
price_lovelace BigInt?
}
model claynation {
id Int @id @default(autoincrement())
asset String @unique
policy_id String?
asset_name String?
image String?
name String?
Body String?
Eyes String?
Brows String?
Mouth String?
Clothes String?
Background String?
Accessories String?
Hats_and_Hair String? @map("Hats and Hair")
Body_Rarity Float? @map("Body Rarity") @db.Real
Background_Rarity Float? @map("Background Rarity") @db.Real
Mouth_Rarity Float? @map("Mouth Rarity") @db.Real
Eyes_Rarity Float? @map("Eyes Rarity") @db.Real
Clothes_Rarity Float? @map("Clothes Rarity") @db.Real
Brows_Rarity Float? @map("Brows Rarity") @db.Real
Hats_and_Hair_Rarity Float? @map("Hats and Hair Rarity") @db.Real
Accessories_Rarity Float? @map("Accessories Rarity") @db.Real
price_lovelace BigInt?
}
model thehoskinsons {
id Int @id
asset String @unique
policy_id String?
asset_name String?
image String?
name String?
Type String?
Badge String?
Hat String?
Chain String?
Miscellaneous String?
Type_Rarity Float? @map("Type Rarity") @db.Real
Chain_Rarity Float? @map("Chain Rarity") @db.Real
Badge_Rarity Float? @map("Badge Rarity") @db.Real
Miscellaneous_Rarity Float? @map("Miscellaneous Rarity") @db.Real
Hat_Rarity Float? @map("Hat Rarity") @db.Real
price_lovelace BigInt?
}
model yummiuniverse {
id Int @id @default(autoincrement())
asset String @unique
policy_id String?
asset_name String?
image String?
name String?
Body String?
Face String?
Headwear String?
Background String?
Body_Rarity Float? @map("Body Rarity") @db.Real
Face_Rarity Float? @map("Face Rarity") @db.Real
Headwear_Rarity Float? @map("Headwear Rarity") @db.Real
Background_Rarity Float? @map("Background Rarity") @db.Real
price_lovelace BigInt?
}
model clumsyghosts {
id Int @id @default(autoincrement())
asset String @unique
policy_id String?
asset_name String?
image String?
name String?
Body String?
Face String?
Eyes String?
Glasses String?
Hands String?
Outfit String?
Backdrop String?
Background String?
Hat String?
Backpack String?
price_lovelace BigInt?
}
model degencryptoclub {
id Int @id @default(autoincrement())
asset String @unique
policy_id String?
asset_name String?
image String?
name String?
Body String?
Eyes String?
Head String?
Beard String?
Mouth String?
Airdrop String?
Earring String?
Clothing String?
Background String?
price_lovelace BigInt?
}
model derpbirds {
id Int @id @default(autoincrement())
asset String @unique
policy_id String?
asset_name String?
image String?
name String?
Back String?
Body String?
Ears String?
Eyes String?
Head String?
Tail String?
Color String?
Beakface String?
Basecolor String?
price_lovelace BigInt?
}
model transactions {
id Int @id @default(autoincrement())
asset String
tx_hash String
datum_hash String
action String
price_lovelace BigInt
signer_address String
created_at DateTime @default(now()) @db.Timestamptz(6)
@@index([asset])
}
model zombiechains {
id Int @id @default(autoincrement())
asset String @unique
policy_id String?
asset_name String?
image String?
name String?
Hat String?
Eyes String?
Nose String?
Skin String?
Mouth String?
Chains String?
Weapon String?
Clothing String?
Earrings String?
Background String?
price_lovelace BigInt?
}
model claynationxgoodcharlotte {
id Int @id @default(autoincrement())
asset String @unique
policy_id String?
asset_name String?
image String?
name String?
Background String?
Clay_Colour String? @map("Clay Colour")
Clothes String?
Eyes String?
Eyebrows String?
Hats___Hair String? @map("Hats & Hair")
Accessories String?
Mouth String?
price_lovelace BigInt?
}
model lionlegends {
id Int @id @default(autoincrement())
asset String @unique
policy_id String?
asset_name String?
image String?
name String?
Fur String?
Hat String?
Mouth String?
Clothes String?
Eyewear String?
Background String?
price_lovelace BigInt?
}
model babyalienclub {
id Int @id @default(autoincrement())
asset String @unique
policy_id String?
asset_name String?
image String?
name String?
hat String?
body String?
eyes String?
face String?
mouth String?
clothes String?
accessory String?
background String?
price_lovelace BigInt?
}
model lunars {
id Int @id @default(autoincrement())
asset String @unique
policy_id String?
asset_name String?
image String?
name String?
Face String?
Suit String?
Lunar String?
Bracelet String?
Accessory String?
Hand_Item String? @map("Hand Item")
Background String?
price_lovelace BigInt?
}
model statistics {
id Int @id @default(autoincrement())
policy_id String
total_volume BigInt?
floor_lovelace BigInt?
total_owners Int?
volume_lovelace_24h BigInt?
total_tx_24h Int?
volume_lovelace_7d BigInt?
total_tx_7d Int?
volume_lovelace_30d BigInt?
total_tx_30d Int?
created_at DateTime @default(now()) @db.Timestamptz(6)
}
Environment & setup
- OS: MacOS -->
- Database: PostgreSQL -->
- Node.js version: v17.0.1 -->
Prisma Version
prisma : 3.2.1
@prisma/client : 3.2.1
Current platform : darwin
Query Engine (Node-API) : libquery-engine b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine : migration-engine-cli b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash : b71d8cb16c4ddc7e3e9821f42fd09b0f82d7934c
Studio : 0.435.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Connection pool - Prisma
The relational database connectors use Prisma's connection pool. The connection pool has a connection limit and a pool timeout, which are controlled by ......
Read more >issue with connection pool ? #7644 - prisma/prisma - GitHub
I'm trying to diagnose a connection pool problem we have in production. The DB is a timescaleDB, but viewed from Prisma, it's simply...
Read more >Using Prisma to Address Connection ... - DEV Community
The connection pool ensures that any database queries are within the connection and timeout limits that you have configured. It coordinates the ...
Read more >Timed out fetching a new connection from the connection pool ...
You can configure the connection_limit and pool_timeout parameters while passing them in the connection string.
Read more >Connection Pooling | RedwoodJS Docs
To work around this issue, you must connect directly to the database rather than going through PgBouncer when migrating. For more information on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry, its not about the connection pool. You’re right, keep it to the subject. I’ll open another issue soon
Which issue exactly @VincentThomas06? Blake had mentioned two above. If it is not about not working with a connection pool, optimally open a new issue please.