Ryan Gillie
How to forward headers (cookies) w/ Tanstack Start
I followed the example repository to get up and running, but I can't seem to get cookie-based authentication to work during the ssr pass. Just doesn't look like the headers are being forwarded on to the fetch call. I tried attaching
...(typeof window === 'undefined' && headers: getHeaders()})
to the createTRPCClient
call in router.tsx
which works in dev and fails in build (probably because that function isn't supposed to be used there). Any help would be appreciated!4 replies
Transform Errors
I get really lazy with my prisma try / catch and was wondering the best place to handle those errors and make them more generic for the front end. I've looked at both https://trpc.io/docs/error-formatting and https://trpc.io/docs/error-handling, but not super sure which one it would be handled in.
Basically I just want to check if it's a prisma error, change it to a generic error, and change the message so the users won't know a unique key lookup failed for example
2 replies