Skip to content

Cannot destructure property 'sentryWebpackPlugin' of 'utils.loadModule(...)' as it is undefinedΒ #13665

@klaa97

Description

@klaa97

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

8.30.0

Framework Version

Next 13.4.7

Link to Sentry event

No response

Reproduction Example/SDK Setup

I have the following versions:

  • Next 13.4.7 (but it also fails with 12.3.1)
  • Sentry 8.30.0
  • React 18.3.1

If I add the withSentryConfig to NextJS, such as this:

withSentryConfig(configWithPlugins, {
// private configs (org, project, token)
			hideSourceMaps: true,
			disableLogger: true,
		});

I get an error when building:

> Build error occurred
TypeError: Cannot destructure property 'sentryWebpackPlugin' of 'utils.loadModule(...)' as it is undefined.
    at Object.newWebpackFunction [as webpack] (/Users/project/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sentry/nextjs/build/cjs/config/webpack.js:324:15)
    at getBaseWebpackConfig (/Users/project/node_modules/.pnpm/[email protected]_37z3we5wden4rzgrojygioj2rq/node_modules/next/dist/build/webpack-config.js:2113:32)
    at async Promise.all (index 1)
    at async Span.traceAsyncFn (/Users/project/node_modules/.pnpm/[email protected]_37z3we5wden4rzgrojygioj2rq/node_modules/next/dist/trace/trace.js:103:20)
    at async webpackBuildImpl (/Users/project/node_modules/.pnpm/[email protected]_37z3we5wden4rzgrojygioj2rq/node_modules/next/dist/build/webpack-build/impl.js:133:21)
    at async webpackBuild (/Users/project/node_modules/.pnpm/[email protected]_37z3we5wden4rzgrojygioj2rq/node_modules/next/dist/build/webpack-build/index.js:137:16)
    at async /Users/project/node_modules/.pnpm/[email protected]_37z3we5wden4rzgrojygioj2rq/node_modules/next/dist/build/index.js:558:123
    at async Span.traceAsyncFn (/Users/project/node_modules/.pnpm/[email protected]_37z3we5wden4rzgrojygioj2rq/node_modules/next/dist/trace/trace.js:103:20)
    at async build (/Users/project/node_modules/.pnpm/[email protected]_37z3we5wden4rzgrojygioj2rq/node_modules/next/dist/build/index.js:145:29)

Steps to Reproduce

  1. Simple app with the versions I defined above
  2. If I add SentryWithConfig, it fails
  3. Otherwise, it does not

Expected Result

It succeeds the build

Actual Result

It fails the build with the error above

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPackage: nextjsIssues related to the Sentry Nextjs SDK

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions