getsentry / sentry-javascript

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

Problem with updating @sentry/vue #10048

Closed randomailer closed 7 months ago

randomailer commented 9 months ago

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/vue

SDK Version

7.91.0

Framework Version

vue@2.6.6

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

mydea commented 9 months ago

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.

randomailer commented 9 months ago

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

lforst commented 9 months ago

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

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

randomailer commented 9 months ago

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).

lforst commented 9 months ago

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

randomailer commented 9 months ago
 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.
lforst commented 9 months ago

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.

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


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