Next.js Discord

Discord Forum

Using postgres is throwing error

Unanswered
Birman posted this in #help-forum
Open in Discord
BirmanOP
Whenever I try to use postgres I get this error Failed to load external module node:stream: TypeError: Native module not found: node:stream stack trace leads to node_modules/.pnpm/postgres@3.4.2/node_modules/postgres/cf/src/connection.js (0:0)

postgres version is "postgres": "3.4.2"

5 Replies

BirmanOP
I also get this in the console Error: Failed to load external module node:stream: TypeError: Native module not found: node:stream
BirmanOP
I tried downgrading the postgres version, but this doesn't help
I turned off the --turbo flag for my dev server and now I am getting
Module build failed: UnhandledSchemeError: Reading from "cloudflare:sockets" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "cloudflare:" URIs.


I am trying to connect to supabase database and grab a session from it in my nextjs middleware and this crashes
BirmanOP
Ok, I did some more digging, I encountered this thread in case someone else encounters this issue https://github.com/vercel/next.js/discussions/50177#discussioncomment-8207889

downgrading to 3.3.0 exactly fixed the issue....
BirmanOP
Ok, this part of code works, but it breaks in a different place... Is there any way to hook up supabase connected with DrizzleAdapter and use it in middleware?