Cannot set headers after they are sent to the client
I have used login system from this repo https://github.com/itsrakeshhq/finance-tracker/tree/main/backend/src/modules/auth but reworked it to tRPC v11 (11.0.0-rc.824). I changed nothing regarding logic, only stuff regarding new version of tRPC and also i am using tRPC standalone not express. Now I have issue when i try to set cookies in authRouter.login
{ "message": "Cannot set headers after they are sent to the client", "code": "ERR_HTTP_HEADERS_SENT"}
{ "message": "Cannot set headers after they are sent to the client", "code": "ERR_HTTP_HEADERS_SENT"}
How is that possible? Nothing is sent to client before return from this function right? If I remove cookies code, it works fine. But it is quite important to set cookies for login endpoint I am stuck on this for hours and I tried everything! Please help