getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.97k stars 1.57k forks source link

@sentry/nextjs: v6.7.2 (and v6.8.0) does not work with next-compose-plugins #3733

Closed jakst closed 2 years ago

jakst commented 3 years ago

Package + Version

Version:

6.7.2

Description

When upgrading from v6.7.1 to v6.7.2 of @sentry/nextjs the plugin no longer builds and uploads sourcemaps. It simply acts as if the plugin was never installed.

const composePlugins = require('next-compose-plugins');
const { withSentryConfig } = require('@sentry/nextjs');

const nextConfig = {
  // ...
};

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 = composePlugins([
  ...otherPlugins,
  [withSentryConfig, sentryWebpackPluginOptions],
], nextConfig);

The above config worked fine on v6.7.1, but does nothing on v6.7.2.

markhughes commented 3 years ago

Only change was a dependency update:

https://github.com/getsentry/sentry-javascript/commit/9cd2b7e4b9d0d749812269ed4e0608697257d54b#diff-e5237f683dda3354b835c7c7c94b9759db2c743d4ba94d47d7f8b8e0b2bfb442

Curious to find out what changed in sentry/webpack-plugin

kamilogorek commented 3 years ago

Curious to find out what changed in sentry/webpack-plugin

It updated sentry-cli by a single minor version. However, only change related to JS API was this - https://github.com/getsentry/sentry-cli/commit/49eeb9aab399cb92b097c3a6c213c9c8dcf0c0df

Can you add debug: true to your plugin config, and run it with export SENTRY_LOG_LEVEL=debug?

CopyJosh commented 3 years ago

Just observed this behavior as well upgrading from 6.7.1 to 6.7.2,

NextJs 10.2.3 "next-compose-plugins": "^2.2.1",

Changing next.config.js to remove next-compose-plugins fixed it immediately.

// next.config.js
const moduleExports = withBundleAnalyzer({
  ...
});
...
module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions);

Will try to gather debug info as well shortly..

--- though rolling back worked, as set up above without next-compose-plugin, we are now getting the following in console...

DevTools failed to load source map: Could not load content for https://[domain]/ddcfa7ccd5b9337cba8d.css.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

DevTools failed to load source map: Could not load content for https://[domain]/_next/static/css/ddcfa7ccd5b9337cba8d.css.map: Load canceled due to load timeout

DevTools failed to load source map: Could not load content for https://[domain]/_next/static/css/9bfc4516136017b290ab.css.map: Load canceled due to load timeout
jakst commented 3 years ago

I just tried to run it with debug: true and SENTRY_LOG_LEVEL=debug, but I get no output from Sentry whatsoever. It's as if the plugin doesn't exist.

I also tried with the new v6.8.0, but the same problem persists.

huggge commented 3 years ago

Im having the same problem.

huggge commented 3 years ago

@Jakst Have you tried adding the withSentryConfigplugin this way?

module.exports = withPlugins(
  [
    [nextTranslate],
    [
      optimizedImages,
      {
        /* config for next-optimized-images */
        optimizeImagesInDev: true,
        mozjpeg: { quality: 95 },
      },
    ],
  ],
  withSentryConfig(nextConfig, SentryWebpackPluginOptions),
)

This solved the issue for me not being able to prevent sourcemap upload because the plugin options were not applied correct due to this issue. However still stuck on 6.7.1

natterstefan commented 3 years ago

Hi @huggge,

I can confirm that this does works for me (tested here https://github.com/natterstefan/next-with-sentry/pull/3), but only with

"@sentry/nextjs": "6.8.0", // also with 6.7.1
"next": "10.2.3" // but not with 10.1.3

I did not test it with next@11.x yet.

jakst commented 3 years ago

@Jakst Have you tried adding the withSentryConfigplugin this way?

module.exports = withPlugins(
  [
    [nextTranslate],
    [
      optimizedImages,
      {
        /* config for next-optimized-images */
        optimizeImagesInDev: true,
        mozjpeg: { quality: 95 },
      },
    ],
  ],
  withSentryConfig(nextConfig, SentryWebpackPluginOptions),
)

This solved the issue for me not being able to prevent sourcemap upload because the plugin options were not applied correct due to this issue. However still stuck on 6.7.1

Yes you're right, plugin options don't work with my setup in my initial setup. I didn't have any options, so I didn't notice.

Your version works well, but as you say, upgrading still does not work. And adding the debug options don't give any extra output.

Has anyone actually gotten anything past version 6.7.1 to work at all? I can't find any circumstances under which it works.

github-actions[bot] commented 3 years ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

schlosser commented 3 years ago

Bumping; this is still relevant!

markhughes commented 3 years ago

not stale

lourensdev commented 2 years ago

Definitely not stale

lobsterkatie commented 2 years ago

This is duplicated by https://github.com/getsentry/sentry-javascript/issues/3579, so let's consolidate the conversation there.