Postgresql hungs infinitely on cloudflare
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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