TanStackT
TanStack4mo ago
42 replies
brilliant-lime

Getting "Function is not serializable" errors when passing functions into the router context

As the title says, I am trying to pass some functions (in this case, my API call client) to my router context to make data fetching easier. This is suggested as a best practice in the Tanstack Router docs as well.

However, I keep getting errors saying "Function is not serializable" and my builds are now failing. This issue seemingly has occurred overnight in our application.

Using Tanstack Router 1.132.6 and Node v22.19.0
TanStack Router's router context is a very powerful tool that can be used for dependency injection among many other things. Aptly named, the router context is passed through the router and down throug...
Was this page helpful?