router icon indicating copy to clipboard operation
router copied to clipboard

Start: server functions can't serialize error objects

Open aaronlin0122 opened this issue 1 year ago • 1 comments

Which project does this relate to?

Start

Describe the bug

https://discord.com/channels/719702312431386674/1238170697650405547/1295132419812233226

Your Example Website or App

https://github.com/nekochan0122/start-todolist-server-fn

Steps to Reproduce the Bug or Issue

  1. copy .env.example to .env
  2. pnpm db:push
  3. pnpm db:generate
  4. pnpm dev
  5. try to create same todo and see the error in console

Expected behavior

Error objects should be able to serialize.

Screenshots or Videos

No response

Platform

  • OS: Windows
  • Browser: Chrome
  • Start Version: 1.65.0

Additional context

No response

aaronlin0122 avatar Oct 13 '24 21:10 aaronlin0122

if an Error is thrown, it can't be serialized using JSON.stringify

this is what happens currently: https://github.com/TanStack/router/blob/ed07f048a8597858a2bff8b4a558bd68760edb15/packages/start/src/client-runtime/fetcher.tsx#L138-L147

schiller-manuel avatar Oct 13 '24 21:10 schiller-manuel

  1. Pretty sure this is fixed now.

tannerlinsley avatar Feb 02 '25 16:02 tannerlinsley