Next.js Discord

Discord Forum

Anyone able to get the pg library working with the edge runtime?

Unanswered
Calliope Hummingbird posted this in #help-forum
Open in Discord
Calliope HummingbirdOP
I've been experimenting with using the nextjs edge runtime. I'm planning on using postgres as a DB, and the pg library.

When trying to build the project using npm run build, I'm running into errors like:

./node_modules/pgpass/lib/helper.js:3:11
Module not found: Can't resolve 'path'

This error makes sense because path is a node API.

However, cloudflare seems to indicate that this library should work when using node_compat = true.

I'm just wondering it this is currently possible or if I should wait for a while until this gets better support? Do I need to inform NextJS to use the node_compat setting or something?

0 Replies