Closed leo91000 closed 1 month ago
any movement on this issue?
Hi. I assume latest version of pg
should be more compatible with cloudflare workers. If you still experience issues, please ping to reopen 🙏🏼
(BTW main support will be done via db0 connectors)
Hi pi0, definitly better support with pg* and cloudflare for sure.
I was able to set these values in my nuxt project, for anyone that finds and is seeking a resolution
nitro: { esbuild: { options: { target: "ESNEXT", }, }, rollupConfig: { external: ["cloudflare:sockets"], }, preset: "cloudflare-pages", },
TIL about cloudflare:sockets
. Is there any link to docs for it? (we might add it to externals by default)
Nothing concrete, no. Seen it across various issues though. Most relevant would be this one: https://github.com/unjs/nitro/issues/1967
Environment
Node.JS : 16.15.0 NItro : 0.3.8
Reproduction
Here is a simple reproduction link : Stackblitz
Just run
NITRO_PRESET=cloudflare npm run blitz
Notice the message
'pg-native' is imported by pg-native?commonjs-external, but could not be resolved – treating it as an external dependence
The
.output/server/index.mjs
build has now animport e as * from 'pg-native'
: it is not compatible with cloudflare or any worker.Describe the bug
To generate the build, nitro bundle
pg
with it's optional peer dependencypg-native
. However,pg-native
is not compatible with workers since it relies onlibpq
.However this dependency is optional and it would work perfectly fine without it.
-> Is there a way to ignore this dependency, or to mock it because we never use it ?
Additional context
No response
Logs
No response