Next.js Discord

Discord Forum

Code just broke?

Unanswered
Spectacled Caiman posted this in #help-forum
Open in Discord
Spectacled CaimanOP
I think my code just broke out of now where when I saved one of my changes I got this error:
 ⨯ cloudflare:sockets
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.
Import trace for requested module:
cloudflare:sockets
./node_modules/.pnpm/postgres@3.4.4/node_modules/postgres/cf/polyfills.js
./node_modules/.pnpm/postgres@3.4.4/node_modules/postgres/cf/src/index.js
./src/database/schema.ts
./src/lib/auth.ts


I have a really basic project setup with Shadcn, a login route, and next auth and that's it.

4 Replies

Try deleting .next folder
@chisto Try deleting .next folder
Spectacled CaimanOP
I have, I've deleted the next folder, npm cache, and pnpm lock file and I sitll got the same error
Spectacled CaimanOP
I've figured out the issue but don't know how to resolve it. It's because I'm using NextAuth in the middleware function and get the users authentication status and it's changing it to the serverless cloudlfare worker enviornment but apperently I don't have what it needs?
Spectacled CaimanOP
It’s because Postgres can’t be used in a serverless environment