question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: db error: ERROR: canceling statement due to statement timeout

See original GitHub issue

Bug description

I set up a free tier project on supabase with no changes to the project. I then followed this guide. When I got to the step prisma migrate dev --name init, I received this error …

Screen Shot 2022-12-15 at 3 58 19 PM

I took a stab at running prisma migrate reset to see if that would fix anything and that seemed to run.

Screen Shot 2022-12-15 at 10 53 10 AM

How to reproduce

Expected behavior

No response

Prisma information

datasource db {
  provider = “postgresql”
  url      = env(“DATABASE_URL”)
}

generator client {
  provider = “prisma-client-js”
}

model Post {
  id        Int     @id @default(autoincrement())
  title     String
  content   String?
  published Boolean @default(false)
  author    User?   @relation(fields: [authorId], references: [id])
  authorId  Int?
}

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
  posts Post[]
}

Environment & setup

  • OS: macOS
  • Database: PostgreSQL
  • Node.js version: v18.12.1

Prisma Version

Environment variables loaded from .env
prisma                  : 4.7.1
@prisma/client          : 4.7.1
Current platform        : darwin-arm64
Query Engine (Node-API) : libquery-engine 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Migration Engine        : migration-engine-cli 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/@prisma/engines/migration-engine-darwin-arm64)
Introspection Engine    : introspection-core 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/@prisma/engines/introspection-engine-darwin-arm64)
Format Binary           : prisma-fmt 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/@prisma/engines/prisma-fmt-darwin-arm64)
Format Wasm             : @prisma/prisma-fmt-wasm 4.7.1-1.272861e07ab64f234d3ffc4094e32bd61775599c
Default Engines Hash    : 272861e07ab64f234d3ffc4094e32bd61775599c
Studio                  : 0.477.0

Issue Analytics

  • State:open
  • Created 9 months ago
  • Reactions:3
  • Comments:17 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
pootytangcommented, Dec 23, 2022

Hi all, I too was having the same problem following the Mastering Nuxt 3 course. I ran a packet capture to see if there’s any resets and who it’s coming from. The resets seem to be normal resets (connection closing) but seems the connections closing may have been initiated by the client. I can’t decrypt the capture so not sure exactly. However, in doing some more research for this issue, a user named mmoreno, also having the same issue, found this where Prisma is suggesting that you must include a shadowDatabaseUrl for cloud hosted db’s. Then running a prisma db push followed by a prisma migrate dev worked for that user. This seemed to work for me. Here’s the steps I took:

  1. ran prisma migrate reset (successfully)
  2. added SHADOW_DATABASE_URL in my .env file and set it to the same value as DATABASE_URL (link says url and shadowDatabaseUrl should not be the same values)
  3. added shadowDatabaseUrl = env(“SHADOW_DATABASE_URL”) to my shema.prisma datasource db config
  4. ran prisma generate (successfully)
  5. ran prisma db push (successfully)
  6. ran prisma migrate dev (successfully)

Before doing this running migrate failed even after running db push. So hopefully this helps.

4reactions
UnbreakableKidcommented, Dec 16, 2022

having this happen to me. Also with supabase and using their connection string. I’ve tried to do a migration using SQLite instead and it works

Read more comments on GitHub >

github_iconTop Results From Across the Web

PostgreSQL: ERROR - canceling statement due to statement ...
For this query, we can set timeout up to 5 mins, but if it is taking more than 5 mins, then the developer...
Read more >
Troubleshoot an AWS DMS task that failed with "ERROR
How do I troubleshoot an AWS DMS task that is failing with error message "ERROR: canceling statement due to statement timeout"?
Read more >
PostgreSQL statement timeout - Stack Overflow
We have table partitioning on date & time and have a PostgreSQL function to load the incoming request into the table. Sometimes we...
Read more >
L72: Canceling statement due to lock timeout - pganalyze
Explanation: This log event only occurs when lock_timeout was enabled for the connection, and the statement had to wait longer than the specified...
Read more >
ERROR: canceling statement due to statement timeout
Symptoms. The error might be reported in DS-User event log during various activities. "ERROR: canceling statement due to statement timeout" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found