Next.js Amplify JS build failing installing Sentry
See original GitHub issueIs there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Self-hosted/on-premise
Which package are you using?
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:
- Created a year ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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:
Going to close this issue. Thank you for your help.
Thanks, @adeelejaz! Setting
AMPLIFY_NEXTJS_EXPERIMENTAL_TRACE
totrue
helped