Error occurs accessing postgres with drizzle and postgres.js in Remix project
I've created a Remix project using create-cloudflare CLI as guided in https://developers.cloudflare.com/pages/framework-guides/deploy-a-remix-site/
and then I installed
drizzle-orm
and postgres
, but I've got this error when I executed a simple select query:
The code:
This happens while running the app (remix vite:dev
) locally.2 Replies
This issue also reported on postgres GitHub: https://github.com/porsager/postgres/issues/822
GitHub
Unexpected Server Error Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: On...
Unexpected Server Error Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. Received protocol 'cloudflare:' i a...
I also tried with node-postgres:
and it works fortunately.
However, it's quite slow (about 800ms). I guess it's because of calling
connect
and end
, causing a roundtrip maybe.