Skip to content

Next.js Invalid left-hand side in assignment when using compile + generate build commands #16358

Description

@m-sanders

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

9.22.0

Framework Version

15.3.2

Link to Sentry event

No response

Reproduction Example/SDK Setup

https://github.com/m-sanders/nextjs-sentry-asset-prefix

Steps to Reproduce

  1. Create a new Next.js app
  2. Use the Sentry Wizard.
  3. Add assetPrefix to next.config.js
  4. npm run build -- --experimental-build-mode compile
  5. npm run build -- --experimental-build-mode generate

Further information about the experimental mode can be found here and here

Expected Result

A successful build (like with 14.2.2x).

The latest Next.js version that works with these steps is 15.2.5. 15.3.0-canary-0 is the last good working release.

Actual Result

> next build --experimental-build-mode generate

   ▲ Next.js 15.3.2
   - Experiments (use with caution):
     · clientTraceMetadata

   Creating an optimized production build ...
 ✓ Collecting page data
   Inlining static env ...
Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error
/Users/me/code/nextjs-sentry-asset-prefix/.next/server/chunks/575.js:172413
    "/assets/" = userNextConfig.assetPrefix;
    ^^^^^^^^^^

SyntaxError: Invalid left-hand side in assignment
    at wrapSafe (node:internal/modules/cjs/loader:1486:18)
    at Module._compile (node:internal/modules/cjs/loader:1528:20)
    at Object..js (node:internal/modules/cjs/loader:1706:10)
    at Module.load (node:internal/modules/cjs/loader:1289:32)
    at Function._load (node:internal/modules/cjs/loader:1108:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
    at Module.<anonymous> (node:internal/modules/cjs/loader:1311:12)
    at mod.require (/Users/me/code/nextjs-sentry-asset-prefix/node_modules/next/dist/server/require-hook.js:65:28)
    at require (node:internal/modules/helpers:136:16)
Export encountered an error on /_not-found/page: /_not-found, exiting the build.
 ⨯ Next.js build worker exited with code: 1 and signal: null

15.3.0-canary-1 introduced this change vercel/next.js#76990

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions