You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: Only URLs with a scheme in: file, data are supported by the default ESM loader. Received protocol 'cloudflare:'
at new NodeError (node:internal/errors:393:5)
at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1026:11)
at defaultResolve (node:internal/modules/esm/resolve:1106:3)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ESMLoader.import (node:internal/modules/esm/loader:525:22)
at importModuleDynamically (node:internal/modules/esm/translators:110:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
at EventEmitter.connect (file:///Users/jeb/test-cf/node_modules/postgres/cf/polyfills.js:150:27)
at Timeout.connect [as _onTimeout] (file:///Users/jeb/test-cf/node_modules/postgres/cf/src/connection.js:347:12) {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
As stated above, if I do npm run build && npm run start, it works. The issue happens with npm run dev.
I have tried quite a few things:
different NodeJS version: 19, 20, 21.
tried with neon (it works).
tried with a local postgres db/not supabase (same error).
I think it may be an issue with remix/vite/postgres? I spent quite a bit of time looking into it but have not been able to able to debug it. I have limited time and was wondering if someone else ran into that issue.
I tried with drizzle-orm/node-postgres. It works locally but not in prod as pg is using Node.
✘ [ERROR] Build failed with 12 errors:
../node_modules/pg-connection-string/index.js:76:77: ERROR: Could not resolve "fs"
../node_modules/pg/lib/connection-parameters.js:3:18: ERROR: Could not resolve "dns"
../node_modules/pg/lib/connection.js:3:18: ERROR: Could not resolve "net"
../node_modules/pg/lib/crypto/utils-legacy.js:5:27: ERROR: Could not resolve "crypto"
../node_modules/pg/lib/crypto/utils-webcrypto.js:1:27: ERROR: Could not resolve "crypto"
...
So I guess I can use pg in "dev" and "postgres" for the build for now but I would prefer not to.
yeah at present my dev workflow is restarting npm run preview ad nauseum. It doesn't not make for a good DX - if anyone has done the local cloudflare build with the vite watch/hmr, please share here. following this issue to learn more ... cloudflare/workers-sdk#5315
Reproduction
Hi,
I am experiencing with my setup in dev mode (it works if I build and serve my project) with my Remix app.
I am using Remix/Vite/Drizzle/Cloudflare Pages/Supabase.
The issue seems to be cause by the
await db.query.users.findMany()
in my loader:My vite config:
The error I am getting:
My scripts:
As stated above, if I do npm run build && npm run start, it works. The issue happens with npm run dev.
I have tried quite a few things:
I think it may be an issue with remix/vite/postgres? I spent quite a bit of time looking into it but have not been able to able to debug it. I have limited time and was wondering if someone else ran into that issue.
I tried with
drizzle-orm/node-postgres
. It works locally but not in prod as pg is using Node.So I guess I can use pg in "dev" and "postgres" for the build for now but I would prefer not to.
System Info
Used Package Manager
npm
Expected Behavior
It should work locally.
Actual Behavior
It is not working locally and throwing an error.
The text was updated successfully, but these errors were encountered: