Skip to content

Instantly share code, notes, and snippets.

@techlab23
Created February 22, 2024 14:29
Show Gist options
  • Save techlab23/d19c36caea299ac195d46f13b907f9f0 to your computer and use it in GitHub Desktop.
Save techlab23/d19c36caea299ac195d46f13b907f9f0 to your computer and use it in GitHub Desktop.
Sentry Nuxt 3 Plugin
import { defineNuxtPlugin } from '#app'
import * as Sentry from '@sentry/vue'
export default defineNuxtPlugin((nuxtApp) => {
const router = useRouter()
const config = useRuntimeConfig()
Sentry.init({
app: nuxtApp.vueApp,
dsn: config.public.sentryDsn,
autoSessionTracking: true,
enableTracing: true,
integrations: [
new Sentry.BrowserTracing({
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
}),
],
sampleRate: 1,
tracesSampleRate: 1,
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment