nextjs - 💡(How to fix) Fix Turbopack 16.2.0 regression: app/icon.tsx returning Response.redirect() + firebase-admin import + next-intl crashes build with "Cannot read properties of undefined (reading 'default')" [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#91706Fetched 2026-04-08 01:02:22
View on GitHub
Comments
2
Participants
2
Timeline
8
Reactions
1
Author
Timeline (top)
commented ×2labeled ×2closed ×1issue_type_added ×1

Error Message

TypeError: Cannot read properties of undefined (reading 'default') at <unknown> (.next/server/chunks/ssr/[root-of-the-server]__09~zrn2._.js:6:1053) at Array.map (<anonymous>) at aW (...js:6:1031) at aX (...js:6:1248) at aY (...js:6:1613)

Root Cause

  • next build --webpack succeeds on 16.2.0 — Turbopack specific
  • [email protected] with identical code builds fine — clean regression
  • On Windows there is no stack trace, just a digest, making this extremely hard to diagnose. The error points to /_not-found in the real project (not the actual icon.tsx file), sending debugging in completely the wrong direction
  • Took several hours to isolate because the error message is totally misleading
  • Tested [email protected] — still fails, suggesting not yet fixed

Fix Action

Fix / Workaround

All three must be present. Removing any one of them makes the build succeed. Workaround: Convert app/icon.tsx to a proper route handler at app/icon/route.ts with a GET() function instead of a default export.

Code Example

TypeError: Cannot read properties of undefined (reading 'default')
    at <unknown> (.next/server/chunks/ssr/[root-of-the-server]__09~zrn2._.js:6:1053)
    at Array.map (<anonymous>)
    at aW (...js:6:1031)
    at aX (...js:6:1248)
    at aY (...js:6:1613)

---

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows Server 2022 Standard
Binaries:
  Node: 24.11.1
  npm: 11.11.1
Relevant Packages:
  next: 16.2.0
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/Mrelijman/next16.2bug/tree/main/my-next-issue

To Reproduce

  1. Clone https://github.com/Mrelijman/next16.2bug/tree/main/my-next-issue
  2. Run npm install
  3. Run npm run build

Build will fail with: TypeError: Cannot read properties of undefined (reading 'default') at Array.map at .next/server/chunks/ssr/[root-of-the-server]__09~zrn2._.js:6:1053

Current vs. Expected behavior

Current: Turbopack build fails during static page prerendering with:

TypeError: Cannot read properties of undefined (reading 'default')
    at <unknown> (.next/server/chunks/ssr/[root-of-the-server]__09~zrn2._.js:6:1053)
    at Array.map (<anonymous>)
    at aW (...js:6:1031)
    at aX (...js:6:1248)
    at aY (...js:6:1613)

Expected: Build succeeds, as it did on Next.js 16.1.7 with identical code. The crash happens inside Next.js's own bundled SSR chunk, not in user code. The three ingredients required to reproduce:

  1. app/icon.tsx that returns Response.redirect() as default export
  2. import 'firebase-admin/app' anywhere in icon.tsx
  3. next-intl plugin wrapping the Next.js config + a rewrite pointing favicon.ico → /icon

All three must be present. Removing any one of them makes the build succeed. Workaround: Convert app/icon.tsx to a proper route handler at app/icon/route.ts with a GET() function instead of a default export.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows Server 2022 Standard
Binaries:
  Node: 24.11.1
  npm: 11.11.1
Relevant Packages:
  next: 16.2.0
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Turbopack

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

next build (local)

Additional context

  • next build --webpack succeeds on 16.2.0 — Turbopack specific
  • [email protected] with identical code builds fine — clean regression
  • On Windows there is no stack trace, just a digest, making this extremely hard to diagnose. The error points to /_not-found in the real project (not the actual icon.tsx file), sending debugging in completely the wrong direction
  • Took several hours to isolate because the error message is totally misleading
  • Tested [email protected] — still fails, suggesting not yet fixed

extent analysis

Fix Plan

To fix the Turbopack build failure, convert the app/icon.tsx file to a proper route handler.

  • Create a new file app/icon/route.ts with the following content:
import { NextResponse } from 'next/server';

export async function GET() {
  return NextResponse.redirect(new URL('/new-url', 'https://example.com'));
}
  • Remove the app/icon.tsx file or update it to not use Response.redirect() as the default export.
  • Update the next-intl plugin configuration to point to the new route handler if necessary.

Verification

After applying the fix, run npm run build to verify that the build succeeds.

Extra Tips

  • When using next-intl and Turbopack, ensure that all route handlers are properly defined and exported.
  • Be cautious when using Response.redirect() as the default export in route handlers, as it may cause issues with Turbopack.
  • If you encounter similar issues, try to isolate the problem by removing or updating individual components and configurations.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING