storage: Edge runtime timeout with drizzle and vercel postgres

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: vercel/next.js#1 SMP Fri Jan 27 02:56:13 UTC 2023
    Binaries:
      Node: 16.18.0
      npm: 8.19.2
      Yarn: N/A
      pnpm: 8.5.1
    Relevant packages:
      next: 13.4.3-canary.1
      eslint-config-next: 13.4.1
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.0.4

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true), Middleware / Edge (API routes, runtime)

Link to the code that reproduces this issue

https://github.com/Xexr/next_test

To Reproduce

Set vercel postgres env vars (ignore the clerk variable)

Install packages with pnpm install

Navigate to http://localhost:3000

Refresh page 10 or so times and you will see that next hangs and the page doesn’t refresh.

You can also see the behaviour at: https://next-drizzle-test.vercel.app/

Describe the Bug

When using the edge runtime with server actions, drizzle and vercel postgres, data fetching/writing eventually causes next to hang after 5-10 times.

I can’t work out what exactly is causing the hang, but when I disable the edge runtime and use the node runtime, the issue does not exist.

The issue occurs in both development and when deployed to vercel.

Expected Behavior

I should be able to fetch data / refresh the page as many times as I like without next hanging.

Which browser are you using? (if relevant)

Brave Version 1.51.114 Chromium: 113.0.5672.92 (Official Build) (64-bit)

How are you deploying your application? (if relevant)

Vercel

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Yes exactly, I was also surprised by the radio silence as it seems like a setup that is going to be prevalent (next edge, Vercel Postgres, drizzle).

Also asked in the next and drizzle discord help forums and again, silence in both. Pretty disappointing.

I’ll reopen the issue as I realise it’s not actually solved, I’ve just replaced vercel Postgres to get around it.

I’ll try and see if I can work out if the issue is vercel Postgres or drizzle pg to help narrow things down.

Hey there, as far as @vercel/postgres npm package goes, our latest release fixed this issue: https://github.com/vercel/storage/releases/tag/%40vercel%2Fpostgres%400.3.2 You only have to upgrade. If not just let us know in this thread 👍