TRPC not working on multi tenant app
Everything works on localhost.
When I deploy it on the vercel None of the mutations work.
Every query/mutation always return 200 but they contain a weird response:
The error is:
here is the app (only twitch login works) https://app.feedbackvote.com/boards
All of the server side queries that are made with TRPC work
t3-app-dir-supabase
Boilerplate for t3-app-dir-supabase.
![No description](https://cdn.answeroverflow.com/1202195570165559338/image.png)
4 Replies
That response is just the format superjson uses so that looks fine
Might be your client isn’t set up right? I’m not really a NextJS expert
@Jaaneek did you ever come to a fix on this issue? I'm having a similar issue in production (no issues on localhost) where queries & mutations fail with the same error. Weirdly, if I refresh the page/keep trying in production, sometimes they work.
I had a mistake in the code. I didn’t await/return a promise on mutations so they resolved too quickly and the query failed. It was hard to debug because it worked with local host and lambda functions but failed on vercel edge runtime, because they are killing the server as soon as the function ends. Lambda/local host lives beyond that so I couldn’t detect a problem there
Thanks for the quick reply! Do you recall at what level you weren't awaiting/returning the promise? From logging in the route, it does look like the response is being generated in the handler, but only response headers are making it back to the client.
Some context:
logging in the handler:
edge api handler :: response.json() { 0: { result: { data: { json: { success: true } } } } }
console error on the client:
TRPCClientError: Missing result at a.from (https://app-650a44d19-barely.vercel.app/_next/static/chunks
where I'm currently working on https://github.com/barelylabs/barely/pull/35
![No description](https://cdn.answeroverflow.com/1210114210437005312/CleanShot_2024-02-22_at_01.37.082x.png)