TanStack Start + Sentry add-on not working
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
Which project does this relate to?
Start
Describe the bug
Create a new TanStack Start app with Sentry add-on.
Run npm run dev.
Get: TypeError: Cannot read properties of undefined (reading 'VITE_SENTRY_DSN')
I've updated .env.local to include a valid DSN, but that doesn't make any difference.
Your Example Website or App
Steps to Reproduce the Bug or Issue
> npm create @tanstack/start@latest
> npx
> "create-start"
┌ Let's configure your TanStack Start application
│
◇ What would you like to name your project?
│ foo-sentry
│
◇ Would you like to use Tailwind CSS?
│ No
│
◇ Select toolchain
│ Biome
│
◇ What add-ons would you like for your project?
│ Sentry
│
◇ Would you like any examples?
│ none
│
◇ Initialized git repository
│
◇ Installed dependencies
│
└ Your TanStack Start app is ready in 'foo-sentry'.
Use the following commands to start your app:
% cd foo-sentry
% npm run dev
Please check the README.md for information on testing, styling, adding routes, etc.
> cd foo-sentry/
> npm run dev
> dev
> NODE_OPTIONS='--import ./instrument.server.mjs' vite dev --port 3000
file:///home/markwoon/Dev/foo-sentry/instrument.server.mjs:3
dsn: import.meta.env.VITE_SENTRY_DSN,
^
TypeError: Cannot read properties of undefined (reading 'VITE_SENTRY_DSN')
at file:///home/user/foo-sentry/instrument.server.mjs:3:24
at ModuleJob.run (node:internal/modules/esm/module_job:377:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:689:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:96:9)
Expected behavior
I expect the app to start up. But it doesn't.
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.132.0
- OS: Linux
- Bundler: vite
- Bundler Version: 7.1.7
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated instrument.server.mjs entry point and the .env.local setup described in the issue, then run npm run dev in a new TanStack Start app with the Sentry add-on. Confirm whether the failure occurs before Vite loads environment variables; done means the generated app starts successfully with a valid Sentry DSN.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100