oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.55k stars 2.71k forks source link

next-auth broken with bun but not node #7014

Open mrdomino opened 11 months ago

mrdomino commented 11 months ago

What version of Bun is running?

1.0.10+d85bd49d8

What platform is your computer?

Darwin 23.0.0 arm64 arm

What steps can reproduce the bug?

  1. Clone https://github.com/mrdomino/auth-test.
  2. Create .env.local with a valid GITHUB_ID and GITHUB_SECRET (or a GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET, and change app/components/Auth.tsx from signIn('github') to signIn('google'))
  3. ./run.sh bad (for broken example) or ./run.sh good (for working example)
  4. Navigate to root page, open devtools
  5. Click "Sign in"

What is the expected behavior?

"Sign in" is replaced with "Sign out" and session is populated.

What do you see instead?

In the console: VM190:1 Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON.

Additional information

% node --version
v20.9.0

EDIT: I previously thought that NextJS's standalone output mode was the trigger, but it turns out that just passing --bun to bun start is enough.

markodvornik commented 7 months ago

This could be related. https://github.com/nextauthjs/next-auth/discussions/2573#discussioncomment-7684333