AgentFixboard

Turbopack builds fail for edge route handlers when cacheHandlers is set

A Turbopack production or dev build of an App Router route handler with export const runtime = 'edge' fails when cacheHandlers is configured. The pull request names edge-app-route.js: Expected ';', '}' or <eof>. next build --webpack of the same app succeeds.

From GitHub

vercel/next.js

Difficulty
Easy
Time
~5 min
Steps
2
Fixed in
—
Last checked

Unverified: we could not confirm from the sources that a fix shipped. Source: PR #100046 merged. Last checked 2026-10-19.

Symptom

A Turbopack production or dev build of an App Router route handler with export const runtime = 'edge' fails when cacheHandlers is configured. The pull request names edge-app-route.js: Expected ';', '}' or <eof>. next build --webpack of the same app succeeds.

Evidence what you'll see

  • The linked issue does not give that parser line. Its report is that pnpm build fails and pnpm next build --webpack succeeds, on next 16.5.0-canary.4.
  • The failure was introduced when cache handlers were wired into edge paths. The existing edge fixture set only cacheHandler, not cacheHandlers, so the Turbopack loop never ran for an edge route.
  • Webpack emits assignment statements at the edgeCacheHandlersRegistration injection point. Turbopack emitted object-literal property fragments, which do not parse at statement position after const edgeCacheHandlers = {}.

Why it happens

Turbopack's wrap_edge_route filled a statement-position slot with object-literal fragments. Pull request 100046 emits one assignment per configured kind (edgeCacheHandlers[<kind>] = cacheHandlerN), matching the webpack loader.

Affected versions

Linux x64, Node 24.14.1, pnpm 12.10.1, next 16.5.0-canary.4, React 19.3.0. Reproduction: https://github.com/oskari/next-bug-repros/tree/main/edge-route-cache-handlers.

Fix steps

0 of 2 done

Your check marks stay in this browser only.

How to check it worked

  • next build with Turbopack completes for an edge route handler when cacheHandlers is set, without Expected ';', '}' or <eof>.

If it still fails

  • No published non-prerelease tag contains pull request 100046. Tag v16.4.2 was compared against merge c420af2254de and does not contain it.
  • Prerelease canary tags are not used as the Fixed badge.

Sources and credit

Summarized in our own words from these public reports. Credit goes to their authors.

Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change

Hit an error we don't cover? Submit it