sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Problem with updating @sentry/vue

Open randomailer opened this issue 1 year ago • 7 comments

Is there an existing issue for this?

  • [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [X] I have reviewed the documentation https://docs.sentry.io/
  • [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/vue

SDK Version

7.91.0

Framework Version

[email protected]

Link to Sentry event

No response

SDK Setup

Sentry.init({
    Vue,
    dsn: sentryConfig.dsn,
    environment: sentryConfig.env,
    integrations: [
      new Sentry.BrowserTracing({
        routingInstrumentation: Sentry.vueRouterInstrumentation(router),
        tracingOrigins: sentryConfig.tracingOrigins
          ? sentryConfig.tracingOrigins.split(',').filter((a) => a).map(a => new RegExp(a))
          : []
      }),
      new Sentry.Replay()
    ],
    release: packageJson.version,
    tracesSampleRate: 0.8,
    // Capture Replay for 10% of all sessions,
    // plus for 100% of sessions with an error
    replaysSessionSampleRate: 0.08,
    replaysOnErrorSampleRate: 1.0
  })

Steps to Reproduce

I have updated @sentry/vue dependency from version 7.61.0 to 7.91.0 (latest) and start to seeing this error image

If I remove from sentry initialisation Sentry.Replay integration then it works again

Expected Result

Sentry works well with Sentry.Replay

Actual Result

Sentry doesn't work with Sentry.Replay

randomailer avatar Jan 04 '24 09:01 randomailer

Hmm, very weird... could you try updating to 7.75.0 and see if that works? This is before the last change we did to that file (https://github.com/getsentry/sentry-javascript/pull/9394), so I wonder if that resulted in this or if this is something else.

mydea avatar Jan 04 '24 09:01 mydea

@mydea, yes with 7.75.0 everything works as expected. I also tried 7.76.0 and it started to show that error

randomailer avatar Jan 04 '24 10:01 randomailer

I just checked our generated files for 7.76.0 and I don't see any syntax errors: https://unpkg.com/browse/@sentry/[email protected]/esm/isBrowser.js

Can you share what webpack generated for your build? I suspect that you have a buggy transpiler of some sort. Thanks!

lforst avatar Jan 04 '24 10:01 lforst

hmm, I don't know how to share it because first of all I tried to build a production build and it fails. If I build dev build it will provide chunk file which is completely wrapped by webpack (so it is unreadable).

Second thing, there is no way to update webpack because I'm using vue-cli (at least for now).

randomailer avatar Jan 04 '24 11:01 randomailer

You didn't share the production build error yet. Can you do so? Thanks!

lforst avatar Jan 04 '24 11:01 lforst

 ERROR  Failed to compile with 1 error                               12:50:23 PM

 error  in ./node_modules/@sentry/replay/esm/index.js + 2 modules

Unexpected token (16:175)
|   return (
|     // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|     __WEBPACK_MODULE_REFERENCE__5_5b22474c4f42414c5f4f424a225d_asiSafe1__._ ).process !== undefined && __WEBPACK_MODULE_REFERENCE__5_5b22474c4f42414c5f4f424a225d_asiSafe1__._ ).process ).type === 'renderer'
|   );
| }
while analyzing module /Users/titovvalentin/projects/bc-standalone-2-review/node_modules/@sentry/utils/esm/isBrowser.js for concatenation

 ERROR  Error: Build failed with errors.
Error: Build failed with errors.
    at /Users/titovvalentin/projects/bc-standalone-2-review/node_modules/@vue/cli-service/lib/commands/build/index.js:207:23
    at /Users/titovvalentin/projects/bc-standalone-2-review/node_modules/webpack/lib/webpack.js:148:8
    at /Users/titovvalentin/projects/bc-standalone-2-review/node_modules/webpack/lib/HookWebpackError.js:68:3
    at Hook.eval [as callAsync] (eval at create (/Users/titovvalentin/projects/bc-standalone-2-review/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/titovvalentin/projects/bc-standalone-2-review/node_modules/tapable/lib/Hook.js:18:14)
    at Cache.shutdown (/Users/titovvalentin/projects/bc-standalone-2-review/node_modules/webpack/lib/Cache.js:150:23)
    at /Users/titovvalentin/projects/bc-standalone-2-review/node_modules/webpack/lib/Compiler.js:1228:15
    at Hook.eval [as callAsync] (eval at create (/Users/titovvalentin/projects/bc-standalone-2-review/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/titovvalentin/projects/bc-standalone-2-review/node_modules/tapable/lib/Hook.js:18:14)
    at Compiler.close (/Users/titovvalentin/projects/bc-standalone-2-review/node_modules/webpack/lib/Compiler.js:1221:23)
    at /Users/titovvalentin/projects/bc-standalone-2-review/node_modules/webpack/lib/webpack.js:147:16
    at finalCallback (/Users/titovvalentin/projects/bc-standalone-2-review/node_modules/webpack/lib/Compiler.js:441:32)
    at /Users/titovvalentin/projects/bc-standalone-2-review/node_modules/webpack/lib/Compiler.js:458:13
    at Hook.eval [as callAsync] (eval at create (/Users/titovvalentin/projects/bc-standalone-2-review/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/titovvalentin/projects/bc-standalone-2-review/node_modules/tapable/lib/Hook.js:18:14)
    at onCompiled (/Users/titovvalentin/projects/bc-standalone-2-review/node_modules/webpack/lib/Compiler.js:456:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

randomailer avatar Jan 04 '24 11:01 randomailer

This looks suspiciously like https://github.com/getsentry/sentry-electron/issues/805.

I firmly believe this is not an issue within our SDK but rather Webpack itself. Would you mind opening an issue over at https://github.com/webpack/webpack. Referencing this issue and https://github.com/getsentry/sentry-electron/issues/805 may help the maintainers figuring out what is going on.

lforst avatar Jan 04 '24 12:01 lforst

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 remove the label Waiting for: Community, I will leave it alone ... forever!


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

getsantry[bot] avatar Mar 06 '24 08:03 getsantry[bot]