Skip to content

Conversation

@HazAT
Copy link
Contributor

@HazAT HazAT commented Dec 16, 2025

When setting up a fresh tanstack start app and chosing Sentry, it sets it up but when running dev locally first, it fails because no DSN is configured by default. This PR aims to smoothen the UX.

Before

pnpn run dev fails in a fresh project with this
SCR-20251216-jzoh-2

After

SCR-20251216-jzqm

and also added this warning banner + disabling the buttons on the example page:
SCR-20251216-jykp-2

// Check if Sentry DSN environment variable is set
const hasDsn = !!import.meta.env.VITE_SENTRY_DSN
setSentryConfigured(hasDsn)
}, [])
Copy link

Choose a reason for hiding this comment

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

we can do this directly in the useState initializer:

const [sentryConfigured] = useState(() => {
  // Check if Sentry DSN environment variable is set
  const hasDsn = !!import.meta.env.VITE_SENTRY_DSN
})

also, we’re checking for import.meta.env here, but the server instrumentation file does:

const sentryDsn = import.meta.env?.VITE_SENTRY_DSN ?? process.env.VITE_SENTRY_DSN

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

Successfully merging this pull request may close these issues.

2 participants