-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
@sentry/nextjs: can't read data inside next-compose-plugins #3579
Comments
Hey, thanks for reaching out! You should be able to use const withCss = require("@zeit/next-css");
const withSass = require("@zeit/next-sass");
const withPlugins = require("next-compose-plugins");
const withImages = require("next-images");
const SentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
}
// Add withSentryConfig as last plugin arg
module.exports = withPlugins([withCss, withSass, withImages, [withSentryConfig, SentryWebpackPluginOptions]], {
env: {
SENTRY_DSN: "xxx",
}
}); It's important to note that |
Closing this issue as the above comment seems to solve the issue. Please re-open if you need anything else. Thanks! |
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. 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 = {
env: {
SENTRY_DSN: "xxx",
}
};
const SentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
};
module.exports = withPlugins(
[withCss, withSass, withImages],
withSentryConfig(moduleExports, SentryWebpackPluginOptions)
); When I use my code style I don't get any problem too. Thank you. |
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. const withPlugins = require('next-compose-plugins');
const withImages = require('next-images');
const { withSentryConfig } = require('@sentry/nextjs');
const SentryWebpackPluginOptions = {
silent: false,
};
const nextConfig = {
reactStrictMode: true,
future: {
webpack5: true,
},
target: 'serverless',
images: {
domains: ['cdn.sanity.io'],
},
env: {
SITE_URL: process.env.DEPLOY_PRIME_URL || process.env.SITE_URL,
SANITY_PROJECT_ID: process.env.SANITY_PROJECT_ID,
SANITY_DATASET: process.env.SANITY_DATASET,
SANITY_READ_TOKEN: process.env.SANITY_READ_TOKEN || '',
GIT_REF: process.env.COMMIT_REF,
},
};
const nextPlugins = [[withImages, { esModule: true }]];
module.exports = withPlugins(
nextPlugins,
withSentryConfig(nextConfig, SentryWebpackPluginOptions)
); or (from here) const nextPlugins = [
[withImages, { esModule: true }],
(nextConfig) => withSentryConfig(nextConfig, SentryWebpackPluginOptions),
];
module.exports = withPlugins(nextPlugins, nextConfig); or const nextPlugins = [[withImages, { esModule: true }]];
module.exports = withPlugins(
nextPlugins,
withSentryConfig(nextConfig, SentryWebpackPluginOptions)
); but am getting this error:
or sometimes
|
Ah I think the issue here is with We recommend switching to the |
Exactly it. Thank you! (works with any of the variants I shared above) 🙈 |
@AbhiPrasad hi, it looks like SentryWebpackPluginOptions is being ignored when using withSentryConfig inside withPlugins. Reproduction:
const { withSentryConfig } = require('@sentry/nextjs');
const withPlugins = require('next-compose-plugins');
const SentryWebpackPluginOptions = {
release: 'qwe',
dryRun: false,
};
module.exports = withPlugins(
[[withSentryConfig, SentryWebpackPluginOptions]],
{}
);
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) const { withSentryConfig } = require('@sentry/nextjs');
const withPlugins = require('next-compose-plugins');
const SentryWebpackPluginOptions = {
release: 'qwe',
dryRun: false,
};
module.exports = withPlugins(
[],
withSentryConfig({}, SentryWebpackPluginOptions)
); |
@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. |
Hello @lobsterkatie do you have any news about this? |
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.) |
1. react@18 下 font-optimization 有 BUG, Temporary fix: optimizeFonts: false; vercel/next.js#35835 (comment) 2. next@12.1.5 swcMinify 有 BUG, 12.1.4 还是好的, Temporary fix: swcMinify: false; vercel/next.js#36127 (comment) 3. 当前 next@12.1.5 和 @sentry/nextjs@6.19.6 的情况有 BUG, 不会上传 sourcemap 不知道以前是否是好; getsentry/sentry-javascript#3579 (comment)
1. react@18 下 font-optimization 有 BUG, Temporary fix: optimizeFonts: false; vercel/next.js#35835 (comment) 2. next@12.1.5 swcMinify 有 BUG, 12.1.4 还是好的, Temporary fix: swcMinify: false; vercel/next.js#36127 (comment) 3. 当前 next@12.1.5 和 @sentry/nextjs@6.19.6 的情况有 BUG, 新发现仅仅 Windows 有问题, 不会上传 sourcemap 不知道以前是否是好; getsentry/sentry-javascript#3579 (comment)
Please reopen if this still happens in the latest SDK version. |
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)@sentry/nextjs
Version:
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.Then we change the structure like in the documentation, become like this:
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:
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.
The text was updated successfully, but these errors were encountered: