TanStack / TanStack/cli

Error in production but not caught by linter via pnpm build

Open
#167 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
185
Avg merge
18h 45m
Merged PRs (30d)
2

Description

Which 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

https://github.com/remusris/tanstack-start-deployment-bug/blob/master/src/components/ComponentWithImportedZod.tsx

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/components/ComponentWithImportedZod.tsx in the linked reproduction repository, then run pnpm build and compare its result with the deployed Vercel response. Trace why exporting a const from a route into an external component produces a deployed 500 error; done means the reproduction no longer deploys into that failure or the problem is reported during build.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.