Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/nextjs
SDK Version
7.23.0
Framework Version
13.0.6-canary.3
Link to Sentry event
No response
Steps to Reproduce
- a next config
// next.config.jsimport{withSentryConfig}from"@sentry/nextjs";constrewrites=async()=>{constapiUrl=process.env.API_URL.trim();if(!(process.env.SENTRY_DSN||process.env.NEXT_PUBLIC_SENTRY_DSN)){thrownewError("process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN must be defined");}constsentryUrl=newURL(process.env.SENTRY_DSN||process.env.NEXT_PUBLIC_SENTRY_DSN);constsentryProjectId=sentryUrl.pathname.replace("/","");sentryUrl.pathname=`/api/${sentryProjectId}/envelope/`;constsentryProxyURL=sentryUrl.toString();return[{source: "/:path*",destination: "/:path*",},{source: "/sentry",destination: sentryProxyURL,basePath: false,},];};constmoduleExports={
rewrites,reactStrictMode: true,};constSentryWebpackPluginOptions={silent: true,};exportdefaultwithSentryConfig(moduleExports,SentryWebpackPluginOptions);- run
next build
Expected Result
It should build correctly.
Actual Result
next build
info - Loaded env from .env.local
info - Skipping validation of types
info - Linting info - Creating an optimized production build info - Compiled successfully
info - Collecting page data ..TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:387:5)
at URL.onParseError (node:internal/url:565:9)
at new URL (node:internal/url:641:5)
at Object.makeNodeTransport [as transport] (/node_modules/@sentry/node/cjs/transports/http.js:34:23)
at new BaseClient (/node_modules/@sentry/core/cjs/baseclient.js:70:33)
at new NodeClient (/node_modules/@sentry/node/cjs/client.js:44:5)
at Object.initAndBind (/node_modules/@sentry/core/cjs/sdk.js:34:18)
at Object.init (/node_modules/@sentry/node/cjs/sdk.js:159:8)
at Object.init (/node_modules/@sentry/nextjs/cjs/index.server.js:69:8)
at Object.9673 (/.next/server/chunks/290.js:19:45) {
input: '/sentry',
code: 'ERR_INVALID_URL'
}
> Build error occurred
Error: Failed to collect page data for /homepage
at /node_modules/next/dist/build/utils.js:959:15
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
type: 'Error'
}
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/nextjs
SDK Version
7.23.0
Framework Version
13.0.6-canary.3
Link to Sentry event
No response
Steps to Reproduce
next buildExpected Result
It should build correctly.
Actual Result