Closed andirsun closed 1 year ago
Hi, can you check what versions of the @sentry/cli
package you have installed in your node_modules after pruning your package manager cache and reinstalling them? Thanks!
@lforst Thanks for look in to this.
❯ npm ls @sentry/cli
streamline-mono@5.0.2 /Users/andirsun/projects/streamline/streamline-mono
├─┬ @sentry/nextjs@7.62.0
│ └─┬ @sentry/webpack-plugin@1.20.0
│ └── @sentry/cli@1.75.2
└─┬ @sentry/webpack-plugin@2.6.1
└─┬ @sentry/bundler-plugin-core@2.6.1
└── @sentry/cli@2.20.4
Ok you can see there is a clash of @sentry/cli
versions. Can you try to resolve this? Are you overriding any dependencies?
I am using a NX mono repo so I need both libraries, btw I am using latest version of sentry/nextjs
and sentry/webpack-plugin
you think I need to downgrade sentry/webpack-plugin
?
Do you have a reason to be using @sentry/webpack-plugin
? If you're not explicitly using it I recommend uninstalling it.
@lforst Yes I am using it in another project inside the mono repo
/* eslint-disable no-param-reassign */
const {composePlugins, withNx} = require('@nrwl/webpack')
const {withReact} = require('@nrwl/react')
const {merge} = require('webpack-merge')
const {sentryWebpackPlugin} = require('@sentry/webpack-plugin')
const {DeleteSourceMapsPlugin} = require('webpack-delete-sourcemaps-plugin')
const nrwlConfig = require('@nrwl/react/plugins/webpack.js')
const TerserJSPlugin = require('terser-webpack-plugin')
// Nx plugins for webpack.
module.exports = composePlugins(withNx(), withReact(), (config) => {
// Note: This was added by an Nx migration.
// You should consider inlining the logic into this file.
// For more information on webpack config and Nx see:
// https://nx.dev/packages/webpack/documents/webpack-config-setup
nrwlConfig(config)
// These two lines below are needed to fix a nx bug that broke tree shacking, making the bundle size much bigger.
// https://github.com/nrwl/nx/issues/14483
config.resolve.mainFields = ['browser', 'module', 'main']
config.optimization.minimizer.unshift(new TerserJSPlugin())
return merge(config, {
output: {
// Without this the styles won't get properly compiled
publicPath: '',
},
devServer: {
allowedHosts: ['localhost', '.lucidextensions.app'], // We need to allow .lucidextensions.app, otherwise we get "Invalid Host/Origin header error" error message when running it inside of a lucid extension
},
devtool: 'hidden-source-map', // optional, see the #hidden-source-map section for more info: https://github.com/AlexBeauchemin/webpack-delete-sourcemaps-plugin#hidden-source-map
plugins: [
sentryWebpackPlugin({
org: 'webalys',
project: 'streamline-lucid',
// Specify the directory containing build artifacts
include: './build',
ignore: ['node_modules'],
// Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
// and needs the `project:releases` and `org:read` scopes
authToken: process.env.SENTRY_AUTH_TOKEN,
// Set it to false if you want to see source maps files uploaded to sentry.
silent: false,
}),
new DeleteSourceMapsPlugin(),
],
})
})
@lforst I fixed it downgrading @sentry/webpack-plugin from version 2.6.1 to 1.20 to match the version inside @sentry/nextjs
Now the project is working.
❯ npm run start:web
> streamline-mono@5.0.2 start:web
> nx reset && nx run models:check-env-vars && nx run streamline-web:serve --with-deps
> NX Resetting the Nx workspace cache and stopping the Nx Daemon.
This might take a few minutes.
> NX Daemon Server - Stopped
> NX Successfully reset the Nx workspace.
> nx run models:check-env-vars
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target check-env-vars for project models (1s)
> nx run streamline-web:serve:development --with-deps
event - compiled client and server successfully in 10s (3810 modules)
[ ready ] on http://localhost:4200
Cool. Thanks for the update!
@lforst Wait a second. but after downgrade the @sentry/webpack-plugin the project that is using that module is no longer working. I think is too old to use that function ?
NX sentryWebpackPlugin is not a function
inside https://github.com/getsentry/sentry-javascript/issues/8770#issuecomment-1673003215
I recommend you look at the documentation of the packages for the respective versions you're using. In the case of version 1.20.0
you need to look at https://www.npmjs.com/package/@sentry/webpack-plugin/v/1.20.0.
You must expect things to change when going from one major version to another.
it worked! thanks @lforst I will let you know if something comes up.
Btw the old version to use webpack plugin was
const SentryCliPlugin = require('@sentry/webpack-plugin');
const config = {
plugins: [
new SentryCliPlugin({
include: '.',
ignoreFile: '.sentrycliignore',
ignore: ['node_modules', 'webpack.config.js'],
configFile: 'sentry.properties',
}),
],
};
I ran into the same issue - using yarn workspaces with @sentry/nextjs
in one package and another @sentry/node
+ @sentry/webpack-plugin
in another package. Is there any plan to resolve this such that the more recent version of webpack-plugin
can be used?
@CaptainStiggz there are no plans. I think this is an issue with people's setups for their package managers and not the SDK. There is nothing we can do to actually fix this.
@lforst the fix would be you upgrading @sentry/nextjs to use the latest @sentry/webpack-plugin
? https://github.com/getsentry/sentry-javascript/blob/develop/packages/nextjs/package.json#L35
Is there a reason why it's still in 1.x after almost 6 months of 2.x having been released?
Is there a reason why it's still in 1.x after almost 6 months of 2.x having been released?
@rdsedmundo Yes. Upgrading it would be a breaking change.
it worked! thanks @lforst I will let you know if something comes up.
Btw the old version to use webpack plugin was
const SentryCliPlugin = require('@sentry/webpack-plugin'); const config = { plugins: [ new SentryCliPlugin({ include: '.', ignoreFile: '.sentrycliignore', ignore: ['node_modules', 'webpack.config.js'], configFile: 'sentry.properties', }), ], };
I think you can use alias when installing the sentry webpack plugin to avoid the version conflict instead of downgrading and using the old plugin. e.g.
yarn add your-alias@npm:@sentry/webpack-plugin --dev
const {
sentryWebpackPlugin,
} = require('your-alias');
@andirsun
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
7.62.0
Framework Version
Next 13.2.1
Link to Sentry event
No response
SDK Setup
No response
Steps to Reproduce
SentryWebpackPlugin.cliBinaryExists is not a function
when running my next js app with nx monorepoThis is my next config
withSentryConfig(nextConfig)
and use directly nextConfig, the project works without sentry.Expected Result
Works normally with
withSentryConfig(nextConfig)
support.Actual Result