NuxtN
Nuxt15mo ago
cosbgn

Please help me understand why cloudflare can't connect to postgres on nuxt

So postgres works on cloudflare workers, but with nuxt it can't connect. My guess is that it has to do with sockets. Is there a way to debug better this error? This is a quick reproduction:

Nuxt: https://github.com/cosbgn/pg-cloudflare/blob/main/server/api/test.js

or: https://github.com/cosbgn/pg-cloudflare/blob/main/server/api/psql.js


DB_PASSWORD: Please DM (it's a demo PSQL)

Try it locally with:
NITRO_PRESET=cloudflare_module npm run build

and:
npx wrangler dev --remote .output/server/index.mjs --site .output/public --log-level debug


With just nuxt dev it works perfectly, it's only on workers that it hungs and timesout.

Any help is very appreciated!
Was this page helpful?