nitrojs / nitrojs/nitro

Postgresql hungs infinitely on cloudflare

Open
#2,779 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Environment

cloudflare pages & workers (I tested both).

Reproduction

Try any postgres connection, for example: https://github.com/cosbgn/pg-cloudflare/blob/main/server/api/psql.js
(email me for the password at username at gmail.)

You can test locally by running:

NITRO_PRESET=cloudflare_module npm run build
and then:
npx wrangler dev --remote .output/server/index.mjs --site .output/public --log-level debug

I think the issue is cause by nitro. On both workers dev and workers deployed it hungs forever.

I tested with multiple databases (Digital Ocean and Aiven/AWS).

Describe the bug

It just hungs forever and eventually it times out.

Additional context

No response

Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction in server/api/psql.js, then run NITRO_PRESET=cloudflare_module npm run build and npx wrangler dev --remote .output/server/index.mjs --site .output/public --log-level debug. Compare the behavior across Cloudflare Pages and Workers and use the debug output to determine why a PostgreSQL connection hangs; done means the cause is identified and the connection no longer times out.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, typescript
Domain
backend, cloud, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.