tRPC doesn't support redirect

I use tRPC & @trpc/server/adapters/express.

procdure.query({ctx: { res }} => {

this will stop node process and some errors like:

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client.

But if I just use expressjs,it does not happen.
You shouldn't do this, tRPC is not a http server, it's an abstraction which can (but doesn't have to) live inside one
If you want redirects, do it on the frontend in response to state changes, or use a http server for those endpoints
I see here
I will try to solve it like
1. express router + tRPC caller
2. try catch in trpc procedure that redirect
It works well using the first method.
The NO.2 remains the same error too.

Looking for more? Join the community!

Recommended Posts
How to get external key other than INPUT from RESTFUL request?SSO callback my api like api/trpc/user.login?token=abcCannot read properties of undefined (reading 'createTRPCReact')I'm trying to use it in an Astro project. https://github.com/Industrial/test-astro-solid/blob/main/application/octet-stream responseIm refactoring my old backend to trpc so far it was a pleasure and fairly straight forward process ❤Discriminated union handleHow Do I handle Input type if its discriminated union?? ``` export const batchTasksRouter = createHit external APIs ...I'm new to tRPC, I need to hit an external API (OpenAI) directly from the client-side. Can I still uCannot get subscription event to fireRipping my hair out here trying to get Websockets working with tRPC and Next. Everything seems to bHow to get response type depending on the input params?Simple example of a normal JS function with generics: ``` const example = <T extends unknown>(paramshow to build tRPC and Prisma with express?I am using TSC as the official docs example does. But when I use paths in tsconfig.json, It does notHow to infer types from input?When I call my procedure from the client I send an array of strings as an input. How can I infer theHow to infer types of a queryCoinsider the example `const hello = trpc.hello.useQuery();` I would like to export the type we get trpc + AWS Lambda (through cdk)Hi all, has anyone successfully integrated tRPC with AWS Lambda? My current stack is API Gateway + LIs it possible to narrow an output schema if the query optionally doesn't return all fields?I have a router procedure that has an input schema that has an optional `filter` that changes the sh