NextAuth's Credentials provider pulls in Prisma -> pg -> Node.js crypto, which crashes in the Edge runtime. Extract an auth.config.ts with only JWT/session callbacks (no DB, no bcrypt) and use NextAuth(authConfig) in middleware. auth.ts spreads the config and adds the Credentials provider. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>