Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start: server functions can't serialize error objects #2535

Open
nekochan0122 opened this issue Oct 13, 2024 · 1 comment
Open

Start: server functions can't serialize error objects #2535

nekochan0122 opened this issue Oct 13, 2024 · 1 comment
Labels
start Everything about TanStack Start

Comments

@nekochan0122
Copy link
Contributor

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

@schiller-manuel
Copy link
Contributor

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

this is what happens currently:

if (isJson) {
throw new Error(
JSON.stringify({
message,
body,
}),
)
} else {
throw new Error(
[message, `${JSON.stringify(body, null, 2)}`].join('\n\n'),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
start Everything about TanStack Start
Projects
Status: Ready
Development

No branches or pull requests

3 participants