♻️ refactor(app.js): Initialise Sentry uniquement en production pour éviter les erreurs en dev.

This commit is contained in:
Serreau Jovann
2025-11-21 21:52:28 +01:00
parent dd26699cc7
commit 2f813b50f7

View File

@@ -469,30 +469,30 @@ document.addEventListener('DOMContentLoaded', ()=>{
})
}
Sentry.init({
dsn: "https://129785624e32fc0d4d7d8002a03b77b7@o4509563601092608.ingest.de.sentry.io/4510392640340048",
// Setting this option to true will send default PII data to Sentry.
// For example, automatic IP address collection on events
sendDefaultPii: true,
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration()
],
tunnel: "/tunnel",
// Tracing
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
// Remplacez l'ancienne valeur par celle-ci dans Sentry.init()
tracePropagationTargets: [
"localhost",
/^https:\/\/www\.e-cosplay\.fr/
],
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0 // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});
const env = document.querySelector('meta[name="env"]')
if(env.getAttribute('content') == "prod") {
Sentry.init({
dsn: "https://129785624e32fc0d4d7d8002a03b77b7@o4509563601092608.ingest.de.sentry.io/4510392640340048",
// Setting this option to true will send default PII data to Sentry.
// For example, automatic IP address collection on events
sendDefaultPii: true,
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration()
],
tunnel: "/tunnel",
// Tracing
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
// Remplacez l'ancienne valeur par celle-ci dans Sentry.init()
tracePropagationTargets: [
"localhost",
/^https:\/\/www\.e-cosplay\.fr/
],
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0 // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});
if (typeof navigator.serviceWorker !== 'undefined') {
// Assurez-vous que le Service Worker est bien enregistré en mode prod
navigator.serviceWorker.register('sw.js')