Closed dev-cetus closed 9 months ago
Any luck with the latest ? (v3.4.3)
Doesn't work, same error... You can check de code.
build it with
$env:NITRO_PRESET='cloudflare'; $env:NUXT_JWT_SECRET='djisiu'; $env:DATABASE_URL='postgres://postgres:postgres@localhost:5432/postgres'; pnpm run build
(database is not required for build)
Sorry, but I'm not going to debug why some other build tool doesn't know how to handle this. Create an issue in their repo.
@dev-cetus , did you figure out how to get this working?
I am trying to run Cloudflare Pages Functions with Nuxt 3.8.2.
and this library(postgres(3.4.3
) and it fails with the same approximate error during build.
[error] Cannot resolve "cloudflare:sockets" from "/opt/buildhome/repo/node_modules/postgres/cf/polyfills.js" and externals are not allowed!
Pages functions don't support
node_compat = true
or toml files at all. Now you can set nodejs_compat
but that doesn't work out of the box.
This issue seems related to:
It comes up a lot in this repository.
Now this appears to be something related to bundling as @porsager mentions in the various threads (be it webpack, or vite, or whatnot). I just don't know enough about the JS tools to actually debugging - I'm just a user who wants to access a postgres database.
This comment seems like the most thorough on the subject and I'm just hoping that either (a) someone can help resolve this issue, (b) to leave breadcrumbs for others or (c) at least rubber 🦆 my way out of this... Any help appreciated.
Same issue Vercel Edge Functions. This issue is not regarding Cloudflare, but regarding serverless edge workers environments. This project does not work on serverless edge workers. @porsager do you mind reopening this issue?
I wonder why postgres
adds this polyfills anyway. If they would be removed and rather be optional the problem might be solved.
Did anyone find a workaround in the end? Keen to use Postgres on CF but this polyfill error on build is blocking progress. Thanks!
Any updates?
still isnt fixed
Try installing latest from github npm install porsager/postgres
I'll make a release soon if that works fine 😉
I just tried npm install porsager/postgres
, got this error instead
⨯ ./node_modules/.pnpm/postgres@https+++codeload.github.com+porsager+postgres+tar.gz+f58cd4f3affd3e8ce8f53e42799672d86cd2c70b/node_modules/postgres/src/connection.js:1:1
Module not found: Can't resolve 'net'
@chenrui333 what platform are you trying to use it on?
I am using vercel edge runtime for the backend. Switch off resolved the issue if that helps.
Yeah. You can't make tcp connections from vercel edge, so Postgres.js won't work there. Neon works because the proxy through websockets.
hi, I'm using Nuxt 3 v3.8, and I'm trying to deploy to cloudflare with the
cloudflare
preset. But I get the following error: I've seen that you've already created a fix for this error, but I'm using version3.4.0
ofpostgres
and the error is still there...My wrangler.toml file contains the line: