How to prevent leaking error messages to client?
Hey everyone!
I noticed that TRPC seems to log quite extensive error codes in the response body of failed requests, even in production builds.
I really don't want my users to be able to see e.g.
Error: connect ECONNREFUSED 10.1.0.6:5432\n at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)\n
Thanks!![No description](https://cdn.answeroverflow.com/1246504550249140315/image.png)
2 Replies
you can write a middleware that with catch your errors and rethrow them with less info
this error stack is not visible when you set NODE_ENV="production"