Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ import { NotFound } from './components/NotFound'
import { QueryClient } from '@tanstack/react-query'
import * as Sentry from '@sentry/tanstackstart-react'

if (typeof document !== 'undefined') {
Sentry.init({
dsn: 'https://ac4bfc43ff4a892f8dc7053c4a50d92f@o4507236158537728.ingest.us.sentry.io/4507236163649536',
integrations: [Sentry.replayIntegration()],
sendDefaultPii: true,
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ['localhost', /^https:\/\/tanstack\.com\//],
// 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.
})
}
Comment on lines +9 to +22
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Privacy/compliance concern with sendDefaultPii: true.

Enabling sendDefaultPii causes Sentry to automatically capture user IP addresses, cookies, and other personally identifiable information. This may conflict with GDPR, CCPA, or other privacy regulations and could require additional disclosure in your privacy policy.

Consider whether this is necessary, or if you can achieve your debugging goals without it.

🛡️ Suggested change to disable PII collection
  Sentry.init({
    dsn: 'https://ac4bfc43ff4a892f8dc7053c4a50d92f@o4507236158537728.ingest.us.sentry.io/4507236163649536',
    integrations: [Sentry.replayIntegration()],
-   sendDefaultPii: true,
+   sendDefaultPii: false,
    // Performance Monitoring
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (typeof document !== 'undefined') {
Sentry.init({
dsn: 'https://ac4bfc43ff4a892f8dc7053c4a50d92f@o4507236158537728.ingest.us.sentry.io/4507236163649536',
integrations: [Sentry.replayIntegration()],
sendDefaultPii: true,
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ['localhost', /^https:\/\/tanstack\.com\//],
// 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 document !== 'undefined') {
Sentry.init({
dsn: 'https://ac4bfc43ff4a892f8dc7053c4a50d92f@o4507236158537728.ingest.us.sentry.io/4507236163649536',
integrations: [Sentry.replayIntegration()],
sendDefaultPii: false,
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ['localhost', /^https:\/\/tanstack\.com\//],
// 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.
})
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/router.tsx` around lines 9 - 22, Sentry is currently initialized with
sendDefaultPii: true which will cause automatic collection of IPs/cookies/PII;
update the Sentry.init call (the Sentry.init block / sendDefaultPii setting) to
set sendDefaultPii: false (or remove the option) and, if you still need to
attach user identifiers selectively, add explicit calls to Sentry.setUser(...)
only where consented, and ensure any server-side IP/PII forwarding is disabled
or scrubbed before sending.


export function getRouter() {
const queryClient: QueryClient = new QueryClient({
defaultOptions: {
Expand All @@ -29,26 +44,15 @@ export function getRouter() {
},
scrollToTopSelectors: ['.scroll-to-top'],
})
setupRouterSsrQueryIntegration({ router, queryClient })

if (!router.isServer) {
Sentry.init({
dsn: 'https://ac4bfc43ff4a892f8dc7053c4a50d92f@o4507236158537728.ingest.us.sentry.io/4507236163649536',
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration(),
],
sendDefaultPii: true,
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ['localhost', /^https:\/\/tanstack\.com\//],
// 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.
})
Sentry.addIntegration(
Sentry.tanstackRouterBrowserTracingIntegration(router),
)
}

setupRouterSsrQueryIntegration({ router, queryClient })

return router
}

Expand Down
Loading