createTRPCNext config ctx always returns undefined.
Hi Everyone.
So I'm trying to use TRPC and Nextjs for auth and post query etc. I have client side createTRPCNext below.
when i try to access ctx in config opts it always returns undefined. type says it is NextPageContext | undefined, so i'm guessing i'm missing something. Please let me know if you guys have any ideas.
Also, if you have any idea on using http-proxy with trpc server for cookie assignment etc would be amazing. I been trying to set cookies in proxy server and following this blog's steps https://maxschmitt.me/posts/next-js-http-only-cookie-auth-tokens
With proxy route simple queries works but when i selfHandleResponse and return response, I get TRPCClientError. Thank you for all the help!
4 Replies
I'm also running into this issue, trying to access the request from opts, but it's always a empty object
Hi @MoronPenguin / @Holliday did either of you figure out what the issue is?
@David we don't use trpc anymore, I don't remember if we ended up solving it either unfortunately
unfortunate, thanks for replying