Repository navigation
tanstackstart-react: server route parametrization never applies when the route tree is not at src/, and the matcher skips brace params and index routes #25067
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release (reproduced on 10.75.0; the same code ships in 11.4.0)
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/tanstackstart-react
SDK Version
10.75.0 and 11.4.0 (both inspected)
Framework Version
@tanstack/react-start 1.168.60, @tanstack/react-router 1.170.41, nitro 3.x as the Vite plugin
Link to Sentry event
No response (the report is about missing route parametrization, not an event)
Reproduction Example/SDK Setup
// vite.config.ts
plugins: [
tanstackStart({ srcDirectory: "app" }), // route tree is generated at app/routeTree.gen.ts
nitro(),
react(),
sentryTanstackStart({ telemetry: false, autoInstrumentMiddleware: false }),
]// app/server.ts
import "./instrument.server";
import { isEnabled, wrapFetchWithSentry } from "@sentry/tanstackstart-react";
import handler, { createServerEntry } from "@tanstack/react-start/server-entry";
const entry = { fetch: (request: Request) => handler.fetch(request) };
export default createServerEntry(isEnabled() ? wrapFetchWithSentry(entry) : entry);Routes in the generated tree include /groups/$groupId, /@{$groupSlug}, /@{$groupSlug}/covers/$coverId, /sitemap-{$page}.xml, and index routes such as /artists/.
Steps to Reproduce
The server-side route parametrization from #21147 does not apply to this app, for two reasons that are independent of the runtime (verified on Node):
1. The Vite plugin only reads src/routeTree.gen.ts.
vite/routePatterns.ts resolves path.resolve(root, "src/routeTree.gen.ts"). TanStack Start's srcDirectory option (or generatedRouteTree in tsr.config.json) moves that file, and the plugin silently falls back to []. I built the app and inspected the server chunk: the call is updateSpanWithRouteParametrization(method, url.pathname, []). There is no option on sentryTanstackStart to point at the file. A plugin placed before Sentry's that replaces __SENTRY_ROUTE_PATTERNS__ itself does embed all 79 patterns, so the generated file is available in time; only the path is wrong.
2. The runtime matcher does not follow TanStack's segment grammar.
server/routeParametrization.ts patternToRegex treats a segment as dynamic only when it startsWith("$"). With the correct 79-pattern list injected, Sentry's own matchUrlToRoutePattern returns:
- every affixed (brace) param route unmatched:
/@some-group→null(pattern/@{$groupSlug}),/@some-group/covers/cover123→null,/sitemap-3.xml→null(pattern/sitemap-{$page}.xml); - every index route unmatched, because the URL's trailing slash is stripped but the pattern keeps it:
/artists→null(pattern/artists/),/covers,/events,/groups,/showcase→null; and/groups/abc123/→/groups/$groupId(the layout) instead of the index pattern/groups/$groupId/; - plain
$paramroutes work:/groups/abc123→/groups/$groupId.
Optional segments ({-$x}) and splats ($) are not handled either, though this app has none.
Expected Result
sentryTanstackStartreads the route tree from the configuredsrcDirectory/tsr.config.json, or accepts arouteTreepath option.- Matching follows TanStack's grammar (brace prefix/suffix params, optional segments, splats, index trailing slash), or delegates to the router's own
getMatchedRoutes(pathname)so the SDK never has to re-implement it.
Actual Result
On Node, server transactions keep concrete URLs (GET /groups/abc123) for every app whose route tree is not at src/, and brace-param and index routes are never parametrized even when the pattern list is correct.
Related: #24839 covers the separate Bun/Deno runtime gaps (no http.server span on fetch-style entries such as Nitro's Vercel web entry), which I also see in production on Vercel's Bun runtime. This report is only about the two Node-reproducible defects above.
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsNo status
Activity
linear-code commentedon Oct 5, 2026
JS-3880
ericwholt commentedon Oct 5, 2026
Sorry agent got a bit to over zealous and posted this issue. Feel free to close if needed.
chargome commentedon Oct 6, 2026
@ericwholt All good, your agent actually surfaced a gap 😄
github-actions commentedon Oct 7, 2026
A PR closing this issue has just been released 🚀
This issue was referenced by PR #25071, which was included in the 11.5.0 release.
fix(tanstackstart-react): Fix server route parametrization gaps (gets…