Skip to content
Source
Sign inSign up
TanStack/router

Calling any server function from the client entry point breaks custom serialization adapters #7706

Openroccomaniscalco(GitHub profile, opens in a new tab) opened this issue 2 comments

Which project does this relate to?

Start

Describe the bug

Calling a server function that uses a custom serialization adapter throws a SerovalDeserializationError when any server function is called from the client entry point (client.tsx).

  1. Define a startInstance with custom serializationAdapters in start.ts
  2. Call any server function from the client entry point
  3. Call a server function that uses a custom serialization adapter
  4. A SerovalDeserializationError occurs

Complete minimal reproducer

https://github.com/roccomaniscalco/tanstack-start-createSerializationAdapter

Steps to Reproduce the Bug

  1. pnpm i && pnpm dev
  2. open localhost:3000
  3. Click "Get Animal" button
  4. Observe SerovalDeserializationError in console

Expected behavior

As a user, I expected custom serialization adapters to deserialize successfully, but instead I am seeing a SerovalDeserializationError.

Screenshots or Videos

No response

Platform

  • Router / Start Version:
    "@tanstack/react-router": "1.170.16",
    "@tanstack/react-start": "1.168.26",
  • OS: macOS
  • Browser: Chrome
  • Browser Version: 149.0.7827.156 (Official Build) (arm64)
  • Bundler: vite
  • Bundler Version: ^8.0.0

Additional context

No response

  1. Same bug from a different trigger: oidc-spa's bootstrapOidc (10.x), called at module top level as its docs show, makes a server function call to read env vars while the route tree loads. That is before hydrateStart sets window.__TSS_START_OPTIONS__, so serverFnFetcher caches a plugin list without the app's adapters for the life of the page. Every later response carrying a custom-adapter value fails with Missing plugin for tag "$TSR/t/<key>". It reproduces on @tanstack/react-start 1.168.49, and start-client-core 1.170.34 still has the same cache. Our workaround seeds window.__TSS_START_OPTIONS__ ??= { serializationAdapters } in start.ts, which hydrateStart imports before getRouter. #7708 would fix this for us.

  2. rgripper(GitHub profile, opens in a new tab)commented

    For @tanstack/solid-start 2.0.0-rc.8 and @tanstack/solid-start 2.0.0-rc.9 (haven't checked older versions) I seem to have the same issue and my serializers are not working

Sign in to join this conversation.