Sentry + Nuxt upgrade & (#738)
Implement Enhanced Validation Logging in UserFormRequest - Added a `failedValidation` method in `UserFormRequest` to log validation errors, including request data and user information, to the combined log channel and Slack. - Updated `nuxt.config.ts` to integrate the latest Sentry module and adjusted configurations for improved error tracking. - Refactored the `FeatureBase.vue` component to include error handling during user setup. - Removed the deprecated Sentry plugin and replaced it with the new Sentry Nuxt integration for better performance and maintainability. These changes aim to enhance error tracking and improve the overall robustness of form validation and user experience.
This commit is contained in:
59
client/plugins/sentry.js
vendored
59
client/plugins/sentry.js
vendored
@@ -1,59 +0,0 @@
|
||||
import * as Sentry from "@sentry/vue"
|
||||
|
||||
function getSentryIntegrations() {
|
||||
// don't load on server
|
||||
if (!import.meta.client) return []
|
||||
|
||||
const router = useRouter()
|
||||
const browserTracing = new Sentry.BrowserTracing({
|
||||
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
|
||||
})
|
||||
|
||||
return [browserTracing]
|
||||
}
|
||||
|
||||
export default defineNuxtPlugin({
|
||||
name: "sentry",
|
||||
parallel: true,
|
||||
async setup(nuxtApp) {
|
||||
const vueApp = nuxtApp.vueApp
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
Sentry.init({
|
||||
app: vueApp,
|
||||
dsn: config.public.SENTRY_DSN_PUBLIC ?? null,
|
||||
integrations: getSentryIntegrations(),
|
||||
|
||||
// Set tracesSampleRate to 1.0 to capture 100%
|
||||
// of transactions for performance monitoring.
|
||||
// We recommend adjusting this value in production
|
||||
tracesSampleRate: config.public.SENTRY_TRACES_SAMPLE_RATE,
|
||||
|
||||
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
|
||||
// tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
|
||||
|
||||
// This sets the sample rate. You may want this to be 100% while
|
||||
// in development and sample at a lower rate in production
|
||||
replaysSessionSampleRate: config.public.SENTRY_REPLAY_SAMPLE_RATE,
|
||||
|
||||
// If the entire session is not sampled, use the below sample rate to sample
|
||||
// sessions when an error occurs.
|
||||
replaysOnErrorSampleRate: config.public.SENTRY_ERROR_REPLAY_SAMPLE_RATE,
|
||||
|
||||
beforeSend(event) {
|
||||
if (event.exception.values.length) {
|
||||
// Don't send validation exceptions to Sentry
|
||||
if (
|
||||
event.exception.values[0].type === "FetchError" &&
|
||||
(event.exception.values[0].value.includes("422") ||
|
||||
event.exception.values[0].value.includes("401"))
|
||||
) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
return event
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user