Skip to content

Next.js Amplify JS build failing installing Sentry #5533

@adeelejaz

Description

@adeelejaz

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which package are you using?

@sentry/nextjs

SDK Version

7.9.0

Framework Version

17.0.2

Link to Sentry event

No response

Steps to Reproduce

Followed the configuration guide, added and configured as per docs. Project locally running fine, test errors showing up fine in Sentry console. But when using Amplify JS, the build fails.

Expected Result

Build completing as expected

Actual Result

[INFO]: λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
[INFO]: Starting SSR Build...
[ERROR]: Error: Command failed with exit code 1: node_modules/.bin/next build
                                  warn  - The `target` config is deprecated and will be removed in a future version.
                                  See more info here https://nextjs.org/docs/messages/deprecated-target-config
                                  Failed to compile.
                                  ./node_modules/next/dist/compiled/@next/react-refresh-utils/ReactRefreshWebpackPlugin.js:109:69
                                  Module not found: Can't resolve 'webpack'
                                  Import trace for requested module:
                                  ./node_modules/next/dist/build/webpack-config.js
                                  ./node_modules/next/dist/server/dev/hot-reloader.js
                                  ./node_modules/next/dist/server/dev/next-dev-server.js
                                  ./node_modules/next/dist/server/next.js
                                  ./node_modules/@sentry/nextjs/cjs/utils/instrumentServer.js
                                  ./node_modules/@sentry/nextjs/cjs/index.server.js
                                  ./sentry.server.config.js
                                  https://nextjs.org/docs/messages/module-not-found
                                  ./node_modules/next/dist/compiled/@vercel/nft/LICENSE
                                  Module parse failed: Unexpected token (1:10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions