Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turbopack error with next-auth middleware: _react.default.createContext is not a function #66761

Closed
tom-sherman opened this issue Jun 11, 2024 · 4 comments
Labels
bug Issue was opened via the bug report template. linear: turbopack Confirmed issue that is tracked by the Turbopack team. locked Middleware Related to Next.js Middleware. Turbopack Related to Turbopack with Next.js.

Comments

@tom-sherman
Copy link

tom-sherman commented Jun 11, 2024

Link to the code that reproduces this issue

https://github.com/tom-sherman/next-15-next-auth-middleware-error

Sandbox: https://codesandbox.io/p/github/tom-sherman/next-15-next-auth-middleware-error/csb-2kn7d6/draft/new-wood

To Reproduce

  1. pnpm i
  2. pnpm dev
  3. Load localhost:3000, returns ok
  4. Stop dev server and rm -rf .next to make sure no caches
  5. `pnpm dev-turbo

Current vs. Expected behavior

Expected behavior

Should be able to load localhost:3000

Actual behaviour

⨯ Error [TypeError]: _react.default.createContext is not a function
    at Object.<anonymous> (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/_cafd18._.js:11709:41)
    at [project]/node_modules/.pnpm/next@15.0.0-canary.25_react-dom@19.0.0-rc-6f23540c7d-20240528_react@19.0.0-rc-6f23540c7d-2024_b7zrpq6fnlnpp5u2olazipblr4/node_modules/next/dist/shared/lib/app-router-context.shared-runtime.js [middleware] (ecmascript) (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/_cafd18._.js:11721:3)
    at <unknown> (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/edge-wrapper_5f3c4e.js:555:27)
    at runModuleExecutionHooks (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/edge-wrapper_5f3c4e.js:597:9)
    at instantiateModule (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/edge-wrapper_5f3c4e.js:553:9)
    at getOrInstantiateModuleFromParent (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/edge-wrapper_5f3c4e.js:625:12)
    at commonJsRequire (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/edge-wrapper_5f3c4e.js:156:20)
    at Object.<anonymous> (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/_cafd18._.js:12380:40)
    at [project]/node_modules/.pnpm/next@15.0.0-canary.25_react-dom@19.0.0-rc-6f23540c7d-20240528_react@19.0.0-rc-6f23540c7d-2024_b7zrpq6fnlnpp5u2olazipblr4/node_modules/next/dist/client/components/navigation.js [middleware] (ecmascript) (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/_cafd18._.js:12472:3)
    at <unknown> (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/edge-wrapper_5f3c4e.js:555:27)
 ⨯ Error [TypeError]: _react.default.createContext is not a function
    at Object.<anonymous> (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/_cafd18._.js:11709:41)
    at [project]/node_modules/.pnpm/next@15.0.0-canary.25_react-dom@19.0.0-rc-6f23540c7d-20240528_react@19.0.0-rc-6f23540c7d-2024_b7zrpq6fnlnpp5u2olazipblr4/node_modules/next/dist/shared/lib/app-router-context.shared-runtime.js [middleware] (ecmascript) (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/_cafd18._.js:11721:3)
    at <unknown> (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/edge-wrapper_5f3c4e.js:555:27)
    at runModuleExecutionHooks (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/edge-wrapper_5f3c4e.js:597:9)
    at instantiateModule (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/edge-wrapper_5f3c4e.js:553:9)
    at getOrInstantiateModuleFromParent (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/edge-wrapper_5f3c4e.js:625:12)
    at commonJsRequire (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/edge-wrapper_5f3c4e.js:156:20)
    at Object.<anonymous> (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/_cafd18._.js:12380:40)
    at [project]/node_modules/.pnpm/next@15.0.0-canary.25_react-dom@19.0.0-rc-6f23540c7d-20240528_react@19.0.0-rc-6f23540c7d-2024_b7zrpq6fnlnpp5u2olazipblr4/node_modules/next/dist/client/components/navigation.js [middleware] (ecmascript) (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/_cafd18._.js:12472:3)
    at <unknown> (file:///home/tom/code/next-15-next-auth-middleware-error/.next/server/edge/chunks/ssr/edge-wrapper_5f3c4e.js:555:27)

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Thu Jan 11 04:09:03 UTC 2024
  Available memory (MB): 7841
  Available CPU cores: 16
Binaries:
  Node: 20.12.1
  npm: 10.5.0
  Yarn: 1.22.22
  pnpm: 9.1.0
Relevant Packages:
  next: 15.0.0-canary.25 // Latest available version is detected (15.0.0-canary.25).
  eslint-config-next: N/A
  react: 19.0.0-rc-6f23540c7d-20240528
  react-dom: 19.0.0-rc-6f23540c7d-20240528
  typescript: 5.3.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Middleware, Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

Previously discussed in #66162

This is using next-auth v5.0.0-beta.19

@tom-sherman tom-sherman added the bug Issue was opened via the bug report template. label Jun 11, 2024
@github-actions github-actions bot added Middleware Related to Next.js Middleware. Turbopack Related to Turbopack with Next.js. labels Jun 11, 2024
@timneutkens timneutkens added the linear: turbopack Confirmed issue that is tracked by the Turbopack team. label Jun 12, 2024
@jklinehamer
Copy link

Have you found any workaround for this? It's also happening with WorkOS, have to disable turbopack to work locally whatsoever.

@wbinnssmith
Copy link
Member

wbinnssmith commented Jun 18, 2024

This has been fixed in #66534 (available in v15.0.0-canary.31 and later)

Copy link
Contributor

github-actions bot commented Jul 3, 2024

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Jul 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. linear: turbopack Confirmed issue that is tracked by the Turbopack team. locked Middleware Related to Next.js Middleware. Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

4 participants