Error in production but not caught by linter via pnpm build #167
Send to my agentWhich project does this relate to?#
Create Tanstack App
Describe the bug#
I discovered a bug because I was trying to figure out why my code was building and deplying without errors then upon visiting the deployed website getting the response back from the url in return.
{
"error": true,
"url": "https://tanstack-start-deployment-bug.vercel.app/",
"statusCode": 500,
"statusMessage": "Server Error",
"message": "Server Error"
}
I made a repo to demonstrate the issue
https://github.com/remusris/tanstack-start-deployment-bug
below is the deployment url
https://tanstack-start-deployment-bug.vercel.app/
Basically if you export a const from the a route into some component this will trigger the error in deployment.
If you look at the ComponentWithImportedZod.tsx file that is culprit of the issue
If this is non an error please let me know what I'm doing wrong.
Your Example Website or App#
https://tanstack-start-deployment-bug.vercel.app/
Steps to Reproduce the Bug or Issue#
Export a const from a file inside of routes into a component outside of routes. In this case it was a zod schema for validating searchParams
Expected behavior#
The user does not get any build errors or deployment errors but once the URL is live all you get in response is
{
"error": true,
"url": "https://tanstack-start-deployment-bug.vercel.app/",
"statusCode": 500,
"statusMessage": "Server Error",
"message": "Server Error"
}
https://tanstack-start-deployment-bug.vercel.app/
Screenshots or Videos#
Check out the url below
https://tanstack-start-deployment-bug.vercel.app/
Platform#
Google Chrome | 140.0.7339.128 (Official Build) (64-bit) (cohort: Stable) Revision | 36aa3351631d175ee5346a1aaf74ef5d49abe308-refs/branch-heads/7339@{#1850} OS | Windows 11 Version 24H2 (Build 26100.6584)
Additional context#
No response
I'm seeing the same issue with nitro on a freshly generated project.
Project scaffold:
Running it in dev is fine, but
pnpm build && pnpm previewcauses this issueThe local Nitro preview failure is useful context, so I’m keeping this open. Could you share a current minimal repo and the server-side error printed by the preview command, along with your Node and package-manager versions?
AI review notes: Fresh React and Solid apps were generated with the current CLI source and Nitro 3.0.260610-beta. Each imports a value exported by an index route into a component rendered by the root route. Production builds, types, Vite preview and direct Node server requests passed, with the imported value present in the server-rendered HTML. The React check used Start 1.169.4 and Router 1.170.46, Node 24.15.0 and pnpm 12.16.1.
These checks cover local Nitro and a consumed route export. The original Zod import, legacy Start 1.131.7 and Vercel deployment still need a matching reproduction. The screenshots show the HTTP 500 response, but not the server error that explains it.
Sign in to join this conversation.
I tried to reproduce this on the latest generator/build pipeline by creating a fresh app, exporting a value from a route, importing it into a component, then running full production build + server start. I could not reproduce a runtime 500 locally.\n\nGiven this is likely deployment-adapter/runtime specific (e.g. Vercel preset/runtime behavior) rather than scaffold generation, can you provide an updated minimal repro against latest plus exact deploy target/config (adapter, Node runtime, env, and logs)? If reproducible on latest, we should likely track it in the Start runtime repo with that repro.