-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
with-sentry-simple source maps not showing on sentry #11642
Comments
I've had the same issue with Rollbar for months; however, the |
I've managed to fix the issue and get the source maps working on both the server/client using the sentry webpack plugin and the following patch code (applied to the index 04e6ec22..0d4da863 100644
--- a/examples/with-sentry-simple/next.config.js
+++ b/examples/with-sentry-simple/next.config.js
@@ -1,5 +1,11 @@
+// Use the hidden-source-map option when you don't want the source maps to be
+// publicly available on the servers, only to the error reporting
const withSourceMaps = require('@zeit/next-source-maps')()
+// Use the SentryWebpack plugin to upload the source maps during build step
+const SentryWebpackPlugin = require('@sentry/webpack-plugin')
+const { SENTRY_DNS, SENTRY_ORG, SENTRY_PROJECT } = process.env
+
module.exports = withSourceMaps({
webpack: (config, options) => {
// In `pages/_app.js`, Sentry is imported from @sentry/node. While
@@ -20,6 +26,20 @@ module.exports = withSourceMaps({
config.resolve.alias['@sentry/node'] = '@sentry/browser'
}
+ // When all the Sentry configuration env variables are available/configured
+ // The Sentry webpack plugin gets pushed to the webpack plugins to build
+ // and upload the source maps to sentry.
+ // This is an alternative to manually uploading the source maps
+ if (SENTRY_DNS && SENTRY_ORG && SENTRY_PROJECT) {
+ config.plugins.push(
+ new SentryWebpackPlugin({
+ include: '.next',
+ ignore: ['node_modules'],
+ urlPrefix: '~/_next',
+ }),
+ )
+ }
+
return config
},
}) I'll be working on adding these as a PR to repo |
@a14m Thanks for updating the solution. I get the following error when using a Docker container: |
not really but when does that happen? during build?
maybe adding the sentry-cli to the docker file (install as a dependency would solve the issue)... |
Got it working, was using the incorrect variable in the webpack plugin. I guess I shouldn't code at 5 am. 🤦 |
In my case it was becasue |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Following the
with-sentry-simple
exampleI couldn't get the source-maps/source code errors to report correctly to sentry (without
Enable JavaScript Source Fetching
enabled)The output doesn't include the source maps or non-minified source code (as shown in the following screenshot)
I have to enable the feature to get the sentry error as shown below in expected behavior)
I've tried uploading the source may using multiple different approaches but didn't manage to get anything workable
The example mentions this in the README, but doesn't include any example of how to make this work...
To Reproduce
Clone the repo
apply the following changes to
next.config.js
add
tsconfig.json
The script used to upload the source-maps during build time
Configure Sentry project (with the
Enable JavaScript Source Fetching
disabled)adding an example demo page that trigger an error
Expected behavior
Having an error report similar to
System information
Additional context
The text was updated successfully, but these errors were encountered: