T
TanStack3d ago
multiple-amethyst

TanStack Start + Nitro: 404 pages showing 'Cannot GET' instead of notFoundComponent

Environment: - TanStack Start: v1.139.3 - TanStack Router: v1.139.3 - Nitro: v3.0.1-alpha.1 - Vite: v7.2.4 Problem: When using Nitro plugin with TanStack Start, navigating to non-existent routes shows "Cannot GET /invalid-route" instead of rendering the defaultNotFoundComponent. Expected Behavior: The defaultNotFoundComponent defined in the router should render for 404 routes. Current Behavior: Nitro intercepts the request and returns a plain text "Cannot GET /..." response before TanStack Router can handle it. Configuration:
// vite.config.ts:
import { nitro } from 'nitro/vite'
export default defineConfig({
plugins: [
tanstackStart(),
nitro(),
// ...
],
})
// vite.config.ts:
import { nitro } from 'nitro/vite'
export default defineConfig({
plugins: [
tanstackStart(),
nitro(),
// ...
],
})
// router.tsx:
const router = createRouter({
routeTree,
notFoundMode: 'root',
defaultNotFoundComponent: NotFound, // This is ignored
});
// router.tsx:
const router = createRouter({
routeTree,
notFoundMode: 'root',
defaultNotFoundComponent: NotFound, // This is ignored
});
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?