Next.js Discord

Discord Forum

Critical dependency warning using Vercel Postgres/server action?

Unanswered
Griffon Nivernais posted this in #help-forum
Open in Discord
Griffon NivernaisOP
Hi, currently migrating from pages router to app router (it's super sick) and have run into this strange warning. Upon rendering my SSR(?) page, no matter where or how I import my database module using @vercel/postgres, the following warning comes up:
â—‹ Compiling / ...                                                                                                                                                                                
 âš  ./node_modules/node-gyp-build/index.js                                                                                                                                                         
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted                                                                                       
                                                                                                                                                                                                  
Import trace for requested module:
./node_modules/node-gyp-build/index.js
./node_modules/utf-8-validate/index.js
./node_modules/ws/lib/validation.js
./node_modules/ws/lib/sender.js
./node_modules/ws/wrapper.mjs
./node_modules/@vercel/postgres/dist/index-node.js
./src/server/database.ts
./src/app/page.tsx

[Here's my code](https://mystb.in/ChromePerlRegulations), any way to remedy this?

12 Replies

Griffon NivernaisOP
Bump.
Griffon NivernaisOP
Bump.
Devon Rex
I'm also looking for a solution to something similar to this, working through the Next JS tutorial. Get almost the exact same error, caused by the exact same thing it seems (trying to run queries on my postgres database).

Don't have a solution but here's a free bump 👍
Griffon NivernaisOP
Bump.
Merlin
Getting a nearly identical issue; no resolution either
Griffon NivernaisOP
Right, I'm seeing that this is a common issue and there's no resolution. I'll see if I can't simply reproduce this and if I can, will make an issue.
Merlin
Did you make an issue @Griffon Nivernais ?
Griffon NivernaisOP
Haven't had the time as of recent, will sort today though.
Griffon NivernaisOP
Strangely enough, I'm unable to replicate this using Next 13. https://stackblitz.com/edit/stackblitz-starters-tfhgws?file=database.ts
🤔
Merlin
I've been using Next 14.0.3, which version were you using?
Griffon NivernaisOP
Same version.