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
[ error ] ./node_modules/@sentry/node/esm/integrations/console.js Module not found: Can't resolve 'console' in - Sentry in Nextjs #2378
Comments
I think the problem was the version of Then I cleaned |
@afsanefda I still have this issue after clean |
Add: if (!options.isServer) {
config.resolve.alias['@sentry/node'] = '@sentry/browser'
} to the |
Any solution to this? |
It's definitely because of the version inconsistency. please check versions as described above. |
Folllowed the suggestion exactly and I'm still having this issue. |
@5tormTrooper Not sure if this will help, but I forgot to add the () to the require statement:
|
i am still facing this issue: @sentry/node^5.11.0 Anyone can help? |
@philkeys tried that already. No luck. |
I faced same issue after upgrading Next.js from '9.1.6' to '9.3.5'. After some debugging i figured that '@sentry/node' somehow ended up in the client bundle. It seems that this line stopped working all of a sudden.
|
An we reopen this issue? I tried updating all packages and can't figure out how to resolve it. |
Is there any solution for this issue? It seems to be such a generic feature that any library should support out of the box. |
As you can tell, all referenced issues has been already somehow resolved by changing dev config. I'm not able to provide any specific fix if I'm not presented with a concrete problem and repro case. |
@kamilogorek thx for the info. I only see one reference to an issue which seems to be unrelated. The OP suggested updating I'll try to create a reproduction repo, though you'll have to provide a |
any solution? |
I was able to get it to work by closely replicating the example provided. I ran into this issue again when switching to SSG ( |
If you have this line:
Then you also need to install |
in my next.config.js, I was already doing the fs: "empty" method with also aliasing sentry/node with browser when !isServer however adding a console.log there that you can see your log is not printed on the console. digging through the source code of the plugins I had (withSourceMaps, withSass, withOptimizedImages) and adding console.log in each of them, I realized my base config was not being sent to the outer plugins with this method of chaining (they seem to return the config themselves but something is still off):
so your fs: "empty" never gets respected. the solution I found for this was to install next-compose-plugins package then change the export to
|
@vpontis, this didn't work for me. I'm using Sentry with Vue.js and have added this to vue.config.js chainWebpack: (config) => {
config.resolve.alias['@sentry/node'] = '@sentry/browser'
} |
I want to add in case someone is still having issues. If you are using next-source-maps, make sure the |
I don't even have a need for a next.config.js, and I am not using sentry with
is what I put in my |
I ran into this once I started using @zeit/next-source-maps": "0.0.4-canary.1 as well! To fix it, I removed the plugin, and then added the important part of the code to the next config:
It's not a problem with sentry, but with the next source map plugin |
Just in case anyone's not clear exactly how to add the fix to your const isServer = (config) => config.name === 'server';
module.exports = {
webpack: (config) => {
if (!isServer(config)) {
config.resolve.alias['@sentry/node'] = '@sentry/browser';
}
return config;
}
//... other config
} and to @vpotis point below, you need to add the dependancy
|
For anyone using the latest update with |
Package + Version
@sentry/browser
^5.11.0@sentry/node
^5.11.0node
v12.7.0Description
I have a nextjs application and I followed this tutorial provided by nextjs community. The problem is after building and running my app it gives this error:
I rebuild my app and removed my yarn lock and build folder but nothing happened! Although I have the directory in my node_modules!
The error is when I'm trying to import Sentry like this :
import * as Sentry from '@sentry/node';
The text was updated successfully, but these errors were encountered: