T
tRPC

Queries break when in production on Vercel; work on localhost

Queries break when in production on Vercel; work on localhost

Jjaiv10/14/2022
The query is called like this:
const { data } = api.useQuery(["user.!getCount"], {
refetchInterval: interval * 1000,
onSuccess: () => ...
}
const { data } = api.useQuery(["user.!getCount"], {
refetchInterval: interval * 1000,
onSuccess: () => ...
}
every query works on localhost, but once it's deployed to Vercel they all give this same error
UUUnknown User10/14/2022
2 Messages Not Public
Sign In & Join Server To View
Jjaiv10/14/2022
yup it is
UUUnknown User10/14/2022
Message Not Public
Sign In & Join Server To View
Jjaiv10/14/2022
hm true. and that does happen sometimes if it has an error. it returns the html from _document.tsx. i thought it was happening every time but when it's not having an error it only returns the json from trpc so i never looked into it
Jjaiv10/14/2022
this is the response
UUUnknown User10/14/2022
Message Not Public
Sign In & Join Server To View
Jjaiv10/14/2022
no this is for the api route
UUUnknown User10/14/2022
Message Not Public
Sign In & Join Server To View
Jjaiv10/14/2022
i don't think so, everything has been working before. just for whatever reason this recent push caused these problems
UUUnknown User10/14/2022
Message Not Public
Sign In & Join Server To View
Jjaiv10/14/2022
ah
Jjaiv10/14/2022
Oh okay so that makes sense. the html comes when there's an error because vercel puts up this 500 page
Jjaiv10/14/2022
i found a commit where it all works, the one right after is what has things break. later today ill look at the difference
Jjaiv10/14/2022
an interesting thing i found is that on the deployments i get this error, it seems like vercel is hitting a cache...
Jjaiv10/14/2022
maybe since it's returning a page idk yea i have no clue, nothing really changed from the commit that worked to the commit that broke it
UUUnknown User10/14/2022
Message Not Public
Sign In & Join Server To View
Jjaiv10/14/2022
yes in dev and build mode
UUUnknown User10/14/2022
Message Not Public
Sign In & Join Server To View
Jjaiv10/18/2022
not oss if i'm stuck on this though i could make some repo @oscartbeaumont after more debugging I found that the error was being caused by not setting up an env variable on vercel

Looking for more? Join the community!

T
tRPC

Queries break when in production on Vercel; work on localhost

Join Server
Recommended Posts
Can't get client to workHi, I can't get my client to work I'm using Next.js but I have also tried the React method from the Request context inside middleware?Hi, Is it possible to get the request context inside a middleware somehow? I'm trying to migrate data becomes never[] when destructuring with a fallback valueCurrently it doesn't seem possible to set a fallback value on a destructured `data` property, for exSyntaxError Unexpected token u in JSON at position 0 with mutationsI'm trying to use trpc client to await a mutation and just keep getting this error. everything worksLosing the type between the client and serverHello everyone, I am new to tRPC and the magic of types in typescript so I am looking for ideas as tMobile app with tRPCWhat's the suggested way of working with tRPC when it comes to mobile apps? How do you ensure that yHow to use trpc react hooks from an external data sourceHi, I have a monorepo, nextjs and keystone cms. The cms has trpc running, and I managed to get it coNextJS & Keystone CMS, issues when connecting both in a monorepoHello everyone, so I have a monorepo with NextJS and keystone cms, both are running trpc v10beta.15Best practices for implementing an offline applicationHey there! I'm building a full stack react-native app with Expo and a tRPC backend. I'd like for thisomehow when move typed function out of the router files, frontend infer type to be any ?this is inferred corrected since they are in the same file. ``` getX: t.procedure.query(() => { retBig companies that use tRPC?Some of my fellow colleagues were wondering if there are any big companies that use tRPC and how matMigrating to V10 from V9If someone has some ideas on what I might have screwed up when trying to bump tRPC for this public sAuthentication broke after bump to v10 from v9Anyone that has any suggestions on what might have caused this? I get the following error when tryiShow a spinner when any mutation is loading?Looking to show an activity spinner in the header of our application whenever a mutation is in flighSharing schemas between server and clientIn a typical nextJs setup, what is the idiomatic way to share zod schemas between frontend and backev10 Migration interop, router doesnt have attributesHi, i've tried to migrate like stated in the docs, these are my routers. Question: Shouldn't appRoutRecommended file structure for next.js?Hey all - using tRPC heavily with next.js and it's great. Our main `[trpc].ts` file is getting huge Unhandled Runtime ErrorTRPCClientErrorCall Stack Function.from node_modules\@trpc\client\dist\TRPCClientError-09b8a26b.esm.js (57:0) transSharing middleware between TRPC serversWe currently have *microservices* REST API's on Cloudflare Workers and I'm thinking about moving thiIs `trpc.withTRPC` for Next supposed to work with pages or only `_app`?I'd love to only have TRPC mount on certain pages of my Next.js app. Is this currently supported?