Repository navigation
Closed
Description
- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Package + Version
-
@sentry/browser -
@sentry/node -
raven-js -
raven-node(raven for node) - other:
@sentry/nextjs
Version:
"@sentry/nextjs": "^6.4.1",
"next": "^10.2.1",
Description
FYI: We start projects with version < 10.0.0 and then we are upgrading to the latest version.
Previously we have a setting in our next.config.js like this.
const withCss = require("@zeit/next-css");
const withSass = require("@zeit/next-sass");
const withPlugins = require("next-compose-plugins");
const withImages = require("next-images");
module.exports = withPlugins([withCss, withSass, withImages], {
env: {
SENTRY_DSN: "xxx",
}
});
Then we change the structure like in the documentation, become like this:
const { withSentryConfig } = require("@sentry/nextjs");
const withCss = require("@zeit/next-css");
const withSass = require("@zeit/next-sass");
const withPlugins = require("next-compose-plugins");
const withImages = require("next-images");
const moduleExports = withPlugins([withCss, withSass, withImages], {
env: {
SENTRY_DSN: "xxx",
}
});
// other codes
module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions);
When we run the app, env can't read with a struct like that. (start from this we are confused)
But, when we are changing the structure like this:
const { withSentryConfig } = require("@sentry/nextjs");
const moduleExports = {
env: {
SENTRY_DSN: "xxx",
}
};
// other codes
module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions);
The app can run fine, but the problem is we don't want to change like that because we are still using the next-compose-plugins.
Is there any recommendation for us, thank you.
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]@sentry/nextjs: [/-][+]@sentry/nextjs: can't read data inside next-compose-plugins[/+]AbhiPrasad commentedon May 26, 2021
Hey, thanks for reaching out! You should be able to use
withSentryConfigalongsidewithPluginslike this:It's important to note that
withSentryConfigshould be the last plugin passed into the plugin array as the plugins are applied in that order https://github.com/cyrilwanner/next-compose-plugins/blob/master/src/compose.js#L63AbhiPrasad commentedon May 28, 2021
Closing this issue as the above comment seems to solve the issue. Please re-open if you need anything else. Thanks!
Fadhilamadan commentedon Jun 3, 2021
Hey, @AbhiPrasad thank you for your recommendation I appreciate it.
Your code is working for me and there is no problem with it and I want to share my code for references before I change to your code style.
When I use my code style I don't get any problem too.
But, I decided to use your code style because more readable for me.
Thank you.
chris-erickson commentedon Jun 4, 2021
I'm using latest sentry and next.js and have a similar configuration. Would like to detail everything I've tried, they might all be valid options if I can figure out why these resolution errors are happening.
or (from here)
or
but am getting this error:
or sometimes
AbhiPrasad commentedon Jun 4, 2021
Ah I think the issue here is with
target: 'serverless'@chris-erickson , which we don't support as per: #3621We recommend switching to the
experimental-serverless-tracetarget, see: #3575 (comment).chris-erickson commentedon Jun 4, 2021
Exactly it. Thank you! (works with any of the variants I shared above)
🙈
Sm1t commentedon Jun 7, 2021
@AbhiPrasad hi, it looks like SentryWebpackPluginOptions is being ignored when using withSentryConfig inside withPlugins. Reproduction:
When using withSentryConfig outside of plugins, as in the example above, SentryWebpackPluginOptions works as expected - release 'qwe', loading source maps into Sentry was called (terminal: 'Authentication credentials were not provided', as expected)
lobsterkatie commentedon Jul 21, 2021
@Sm1t - Yes, I can see why that's not working. There are a few possible solutions, but it will take some rejiggering on our part to make them workable. I've made a note to bring this to our next team meeting, so that we can figure out how we want to proceed.
2 remaining items
EmilioAiolfi commentedon Mar 31, 2022
Hello @lobsterkatie do you have any news about this?
lobsterkatie commentedon Apr 4, 2022
Unfortunately all of our resources this quarter have been aimed at getting our new major out the door, so I haven't gotten a chance to work on this any more.
(I'm sorry - I know that's not a super satisfying answer. Once the major's out, I can bring this up again with the team.)
紧跟版本的痛啊;
紧跟版本的痛啊;
HazAT commentedon Feb 16, 2023
Please reopen if this still happens in the latest SDK version.