Remove Error message from ServerFn
Hi! I want to make sure that server fns do not leak some information to the client through error messages. Is there a way to globally register a middleware that would handle this?
4 Replies
metropolitan-bronze•2mo ago
hm not sure, can you please create a feature request on github for this? => https://github.com/TanStack/router/discussions/new?category=ideas
GitHub
Build software better, together
GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.

flat-fuchsiaOP•2mo ago
GitHub
Global ServerFn Middleware to Purge Error Message · TanStack route...
Is it possible to set-up a global ServerFn middleware to purge message from any server-side errors? I would like to do this as a paranoid precaution in case there is some sensitive information in s...
flat-fuchsiaOP•2mo ago
Actually, I guess it should be possible with a regular global middleware: https://tanstack.com/start/latest/docs/framework/react/middleware#global-middleware
Middleware | TanStack Start React Docs
What is Server Function Middleware? Middleware allows you to customize the behavior of server functions created with createServerFn with things like shared validation, context, and much more. Middlewa...
harsh-harlequin•2mo ago
Yeah, I catch and log errors in my global logging middleware. So you can definitely then choose to return whatever you want from that point if you don't want to rethrow the error.
I'm still on 1.120.3 though until the official global middleware fix.