Skip to content
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

Suggestion: Sentry [error tracking] #207

Closed
alexcroox opened this issue Aug 20, 2024 · 2 comments
Closed

Suggestion: Sentry [error tracking] #207

alexcroox opened this issue Aug 20, 2024 · 2 comments

Comments

@alexcroox
Copy link

alexcroox commented Aug 20, 2024

Docs: https://docs.sentry.io/platforms/javascript/

For reference this is how I currently instrument it:

import { Capacitor } from '@capacitor/core'
import * as Sentry from '@sentry/vue'

import { appVersion } from '~/shared/version'

export default defineNuxtPlugin({
  name: 'sentry',
  setup(nuxtApp) {
    if (import.meta.env.TEST) {
      return
    }

    const {
      public: { errorReportingEnabled, sentry }
    } = useRuntimeConfig()

    if (!sentry.client.dsn) {
      console.error('Sentry DSN not found in environment')
      return
    }

    Sentry.init({
      enabled: errorReportingEnabled,
      app: nuxtApp.vueApp,
      release: appVersion,
      dsn: sentry.client.dsn,
      // debug: true,
      environment: sentry.environment,
      ignoreErrors: [/Network Error/i, /Fetch Error/i]
    })

    Sentry.setTag('app-platform', Capacitor.getPlatform())
    Sentry.setTag('app-native', Capacitor.isNativePlatform())

    return {
      provide: {
        sentry: Sentry
      }
    }
  }
})

and after the user has logged in or we detect they are already logged in on page load:

this.sentry.setUser({
  id,
  email,
  username,
  roles
})

Thanks!

@alexcroox
Copy link
Author

Zight 2024-08-20 at 6 52 34 PM

This button brought me here, on reflection this should be in the discussions?

@manniL
Copy link
Member

manniL commented Aug 22, 2024

No, that's fine! 👍

We've discussed that in #209 though

@manniL manniL closed this as not planned Won't fix, can't repro, duplicate, stale Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants