question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Next.js Amplify JS build failing installing Sentry

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
adeelejazcommented, Aug 15, 2022

I also tried adding webpack in but I started getting weird error with vercel/nft module. I also checked my package-lock.json file and I do not have a webpack as a dependency.

After a bit of searching found this comment on Amplify JS (#2343), and added the following environment variable to get it working:

AMPLIFY_NEXTJS_EXPERIMENTAL_TRACE=true

Going to close this issue. Thank you for your help.

0reactions
landyrevcommented, Aug 15, 2022

Thanks, @adeelejaz! Setting AMPLIFY_NEXTJS_EXPERIMENTAL_TRACE to true helped

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error building NextJS with @sentry/nextjs on AWS Amplify
I'm just trying to integrate sentry with NextjS v12 using @sentry/nextjs and sentry wizard, everything is fine on localhost and before ...
Read more >
Next.js - Sentry Documentation
On this page, we get you up and running with Sentry's SDK, so that it will automatically report errors and exceptions in your...
Read more >
Hosting - Next.js - JavaScript - AWS Amplify Docs
When you deploy a Next.js app, Amplify inspects the app's build script in the package.json file to detect whether the app is static...
Read more >
Going to Production - Next.js
For best results, use a production build of Next.js and use incognito in your ... on both the client and server-side, using the...
Read more >
How to create a Next.js app with serverless - SST.Dev
It is also not transparent or open source. Amplify in many ways is AWS's version of Vercel. It's cheaper and deploys to your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found