trpc query failing in prod

I'm using trpc's use query together with nextjs 14's server components. The useQuery is in a client component. Everything works perfectly locally, including the productino build. However when I deploy to AWS via sst, it starts failing. Any idea why? This is the error: SyntaxError: Unexpected non-whitespace character after JSON at position 2. It shows up in the browser console through loggerLink. When I inspect on the network tab, it does return the response with the right data. It seems like trpc on the front end isn't able to pass the right stuff to reavt to re-render? Upon checking the response in detail, I see that there's "62 bf" and "0" at the beginning and the end of the json response respectively. This only happens in the deployed version. Not even on the locla built version.
11 Replies
FleetAdmiralJakob ๐Ÿ—• ๐Ÿ—— ๐Ÿ—™
can you show us your code? or screenshots of your network tab or something that we can investigate
shikishikichangchang
shikishikichangchangOPโ€ข9mo ago
No description
shikishikichangchang
shikishikichangchangOPโ€ข9mo ago
No description
shikishikichangchang
shikishikichangchangOPโ€ข9mo ago
network tab no error
FleetAdmiralJakob ๐Ÿ—• ๐Ÿ—— ๐Ÿ—™
GitHub
bug: tRPC error boilerplate code deploying to vercel breaks site ยท ...
Provide environment information System: OS: macOS 14.0 CPU: (8) arm64 Apple M2 Memory: 80.75 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.8.0 - /opt/homebrew/bin/node npm: 10.2.0 - /opt/ho...
shikishikichangchang
shikishikichangchangOPโ€ข9mo ago
i didnt deploy to vercel so that's a separate issue
FleetAdmiralJakob ๐Ÿ—• ๐Ÿ—— ๐Ÿ—™
JSON Parsing, TRPC Client error - Theo's Typesafe Cult
I have a project with various trcp endpoints on nextjs 13.5 and they are working fine on development, but when deploying to vercel i get this strange error of a non-whitespace character on all the GET operations: [next-auth][error][CREATE_USER_EVENT_ERROR] https://next-auth.js.org/errors#create_user_event_error Unexpected non-whitespace charact...
FleetAdmiralJakob ๐Ÿ—• ๐Ÿ—— ๐Ÿ—™
oh ok mhmm Do you have Clerk or Auth.js in the project?
shikishikichangchang
shikishikichangchangOPโ€ข9mo ago
auth.js "next": "^14.1.3", "next-auth": "^4.24.6", found the issue
shikishikichangchang
shikishikichangchangOPโ€ข9mo ago
GitHub
bug: TRPCClientError: Unexpected non-whitespace character - NextJS ...
Provide environment information System: OS: macOS 13.4 CPU: (10) arm64 Apple M1 Pro Memory: 45.86 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin...
shikishikichangchang
shikishikichangchangOPโ€ข9mo ago
the fix was to replace unstable_httpBatchStreamLink with httpBatchLink
Want results from more Discord servers?
Add your server