nuxt-community / sentry-module

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

context.$sentry is undefined in nuxt plugins when disabled in 7.1.11 #553

Closed meinenieuwland closed 1 year ago

meinenieuwland commented 1 year ago

Version

@nuxtjs/sentry: 7.1.11 nuxt: 2.15.8

Sentry configuration

sentry: {
    disabled: !logSentryErrors,
    dsn: process.env.SENTRY_DSN,
    publishRelease: {
      authToken: process.env.SENTRY_AUTH_TOKEN,
      org: process.env.SENTRY_ORG,
      project: process.env.SENTRY_PROJECT,
      setCommits: {
        auto: true,
      },
    },
    config: {
      ignoreErrors: sentryIgnoredErrors,
      release: `${process.env.SENTRY_PROJECT}@${packageJson.version}`,
    },
    clientConfig: {
      replaysOnErrorSampleRate: parseFloat(process.env.SENTRY_ERROR_SESSION_SAMPLE_RATE),
      replaysSessionSampleRate: parseFloat(process.env.SENTRY_SESSION_SAMPLE_RATE),
    },
    customClientIntegrations: '~/plugins/init-custom-sentry-integrations.js',
  },

Reproduction Link

-

Steps to reproduce

-

What is Expected?

context.$sentry should be available inside Nuxt plugins, when the Sentry "disabled" configuration option is true.

What is actually happening?

Locally we set logSentryErrors to false. Before 7.1.11 context.$sentry was available inside nuxt plugins. But you would get this warning: image

As of 7.1.11 this isn't the case anymore. context.$sentry is undefined.

rchl commented 1 year ago

I can't quite reproduce this, to be honest. How do the generated .nuxt/sentry.client.js and .nuxt/sentry.server.js files look like for you?

meinenieuwland commented 1 year ago

I've tested this again today. And I can't reproduce it. I'm sorry to have wasted you time then 😞