Skip to content

React Start dev server-fn resolver should throw when an export is missing #7471

@davegomez

Description

@davegomez

Summary

In a TanStack Start dev server, the server-function resolver can return undefined when the resolved module exists but the requested export is not available yet. The later SSR RPC call then fails with a generic (intermediate value) is not a function, which hides the actual resolver failure.

The production/build resolver already fails loudly for a missing server-function export. It would be much easier to diagnose dev-only SSR failures if the dev resolver matched that behavior and threw a clear error when mod[exp] is undefined.

Observed behavior

During parallel Playwright SSR requests against a React Start app, the first cold authenticated render intermittently hit this path:

  1. Route loader calls an extracted server function during SSR.
  2. Dev resolver resolves the server-function module while the requested export is unavailable.
  3. Resolver returns undefined.
  4. createSsrRpc attempts to call it.
  5. The route renders an error state with a generic (intermediate value) is not a function failure.

Warming the route once before parallel workers start avoids the race, so this report is about diagnostics/fail-loud behavior rather than asking the resolver to serialize module initialization.

Expected behavior

If the dev resolver finds the module but mod[exp] is undefined or not callable, throw an error that includes at least:

  • the server function id / requested export
  • the module path or resolved module id, if available
  • a message explaining that the export was missing from the dev server-function module

Versions from the affected app

  • @tanstack/react-start: observed around 1.168.x
  • @tanstack/react-router: observed around 1.170.x
  • Vite dev server
  • React 19

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions