Skip to content

Next 13 + App Router + static export results in a build error (Specified "rewrites" cannot be used with "output: export") #8285

@metalmarker

Description

@metalmarker

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

7.54.0

Framework Version

Next 13.4.4

Link to Sentry event

No response

SDK Setup

I've used the wizard to create the sentry.*.config.js files. My next.config.js is:
{ images: { unoptimized: true }, experimental: { externalDir: true }, output: 'export', reactStrictMode: true }

Steps to Reproduce

I'm using the Next with the App Router in a static configuration (output: 'export' in next.config.js).
When attempting to build the app, I'm getting:

> Build error occurred Error: Specified "rewrites" cannot be used with "output: export". See more info here: https://nextjs.org/docs/messages/export-no-custom-routes at assignDefaults (/Users/eran/Dev/Butterfly/Website/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/config.js:218:19) at loadConfig (/Users/eran/Dev/Butterfly/Website/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/config.js:550:32) at async Span.traceAsyncFn (/Users/eran/Dev/Butterfly/Website/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/trace/trace.js:103:20) at async /Users/eran/Dev/Butterfly/Website/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/build/index.js:150:28 at async Span.traceAsyncFn (/Users/eran/Dev/Butterfly/Website/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/trace/trace.js:103:20) at async build (/Users/eran/Dev/Butterfly/Website/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/build/index.js:145:29)

This error started following the integration of the Sentry SDK. This error is suppressed when I remove the output: 'export' option.

Expected Result

No errors when building a static website.

Actual Result

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions