nuxt-community / sentry-module

Sentry module for Nuxt 2
https://sentry.nuxtjs.org
MIT License
500 stars 113 forks source link

Adding publishRelease create build fatal error #541

Closed Torone closed 10 months ago

Torone commented 1 year ago

Version

@nuxtjs/sentry: 7.1.6 nuxt: 2.15.8

Sentry configuration

{
    dsn: process.env.SENTRY_DSN || '',
    lazy: true,
    publishRelease: {
      authToken: 'my-token',
      project: 'nuxt-web-client',
      org: 'myOrd',
      release: `my-app@1.10.1`
    },
    tracing: true
  }

Reproduction Link

None

Steps to reproduce

I followed the guide, added it, installed @sentry/webpack-plugin as a dev dependency, and tried deploying my app to Azure. After building the server the app crashed with Nuxt Fatal Error. It is not clear what exactly makes the app crash. And it is unclear if it is caused by the dev dependency or the publishRelease option. Locally it builds regularly. Removing the option publishRelease it deploys regularly.

What is Expected?

To build and complete the deployment without failing.

What is actually happening?

Nuxt Fatal Error, deployment failed.

rchl commented 1 year ago

You haven't provided any error logs. Can't investigate without some relevant information.

Torone commented 1 year ago

Sorry for my late reply:

I just retried now and I think the important part of the logs is this one:

Module not found: Error: Can't resolve 'encoding' in '/tmp/8db30236b53eb25/node_modules/node-fetch/lib'
@ ./node_modules/node-fetch/lib/index.js
@ ./node_modules/cross-fetch/dist/node-ponyfill.js
@ ./node_modules/@prismicio/client/cjs/@prismicio/client.js
@ ./.nuxt/prismic/plugins/prismic.js
@ ./.nuxt/index.js
@ ./.nuxt/server.js
@ multi ./node_modules/@sentry/webpack-plugin/src/sentry-webpack.module.js ./.nuxt/server.js
ERROR in ./node_modules/@sentry/webpack-plugin/src/sentry-webpack.module.js 1:179
Module parse failed: Unexpected token (1:179)
File was processed with these loaders:
* ./node_modules/@sentry/webpack-plugin/src/sentry.loader.js
You may need an additional loader to handle the result of these loaders.
- > var _global = (typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}); _global.SENTRY_RELEASE={id:"1.0.1"};
- |       _global.SENTRY_RELEASES=_global.SENTRY_RELEASES || {};
- |       _global.SENTRY_RELEASES["nuxt-web-client@100asa-ltd"]={id:"1.0.1"};
@ multi ./node_modules/@sentry/webpack-plugin/src/sentry-webpack.module.js ./.nuxt/server.js

I hope you can help, thanks!

rchl commented 1 year ago

Which node version?

Also have you tried updating Nuxt to latest 2.x version?

Torone commented 1 year ago

The Node version is 16.14.0

I tried to update Nuxt, but for some reason, I need to update several dependencies and, at the moment, it is not worth doing it. Do you think this can be solved by updating Nuxt to the latest v2?

rchl commented 1 year ago

Maybe. I don't see this issue after adding @nuxtjs/prismic to a test fixture in this repo and building it so not sure what's the issue for you. Try to npm upgrade or yarn upgrade in your repo and see if it changes anything. Just for testing, you can revert the updates afterwise.

Torone commented 1 year ago

Thanks for your suggestion. After further investigations, it looks like it crashes when I explicitly add the release property.

rchl commented 1 year ago

I can't help further with current amount on information.

Are you able to create a minimal repo that reproduces this issue?

Does it also happen with publishRelease.dryRun set?

Torone commented 1 year ago

I don't know what dryRun is, sorry. I just fixed the deployment removing the "release" property, but I need to manually trigger the release on Senty, via the API call, to set the new one. I will try to create a dedicated repo during the weekend to reproduce the issue. Thanks

rchl commented 1 year ago

I don't know what dryRun is, sorry.

It's an option you can set.

{
    dsn: process.env.SENTRY_DSN || '',
    lazy: true,
    publishRelease: {
      dryRun: true,
      authToken: 'my-token',
      project: 'nuxt-web-client',
      org: 'myOrd',
      release: `my-app@1.10.1`
    },
    tracing: true
  }

It will pretend to publish a release and do most of the normal steps without actually sending the release.

rchl commented 1 year ago

I've just noticed that Nuxt has an issue that makes it hide errors like that. You can enable build.quiet in nuxt config to workaround this issue and see the actual error.

rchl commented 10 months ago

https://github.com/nuxt-community/sentry-module/releases/tag/v8.0.0 updates to v2 of webpack release plugin and I would expect it to either fix this issue. If it doesn't then please create new issue and we can try debugging it further.