jove4015
jove401511mo ago

"Unable to transform response from server" when 401 error returned from middleware (sometimes)

I'm trying to figure out a problem where some (a few, not most) 401 error responses result in an uncaught TransformError "Unable to transform response from server". This does not happen a lot but it does hit our sentry at least once a day. 401 error responses happen all the time (particularly when JWTs expire) and in 99.9999% of cases they are handled correctly. However, every once in a while, you'll see this happen if you're watching the transformResult code (see attached screenshot). This "null" response object comes through after the correct 401 error response has already been processed correctly, so it seems to be an extra, erroneous run through the transformResult function. Any troubleshooting tips or insights on this would be really appreciated - we have no idea where this null is coming from and no route that we have consistently (or even usually) produces this result, it almost seems totally random except it's always in the context of a 401 error response happening.
No description
1 Reply
jove4015
jove401511mo ago
(this code is from @trpc/client/dist/transformResult-xxx.js)