TRPC fails to work on server components in Vercel environment

Getting a Application error: a server-side exception has occurred (see the server logs for more information). on vercel. pnpm run build && run start works fine locally
No description
11 Replies
shikishikichangchang
why is /api/* 0kb? Im running a fresh instance of create t3-app@latest When I navigate to /students Im getting this
shikishikichangchang
log shows this
TRPCClientError: Unexpected token ; in JSON at position 4
at TRPCClientError.from (/var/task/.next/server/chunks/277.js:1:5046)
at /var/task/.next/server/chunks/277.js:1:9567
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
meta: undefined,
shape: undefined,
data: undefined,
[cause]: SyntaxError: Unexpected token ; in JSON at position 4
at JSON.parse (<anonymous>)
at parse (/var/task/.next/server/chunks/277.js:5:4111)
at /var/task/.next/server/chunks/277.js:5:3218
at onChunk (/var/task/.next/server/chunks/277.js:5:3371)
at readStandardChunks (/var/task/.next/server/chunks/277.js:5:3698)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async readLines (/var/task/.next/server/chunks/277.js:5:3452)
at async parseJSONStream (/var/task/.next/server/chunks/277.js:5:3058)
}
TRPCClientError: Unexpected token ; in JSON at position 4
at TRPCClientError.from (/var/task/.next/server/chunks/277.js:1:5046)
at /var/task/.next/server/chunks/277.js:1:9567
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
meta: undefined,
shape: undefined,
data: undefined,
[cause]: SyntaxError: Unexpected token ; in JSON at position 4
at JSON.parse (<anonymous>)
at parse (/var/task/.next/server/chunks/277.js:5:4111)
at /var/task/.next/server/chunks/277.js:5:3218
at onChunk (/var/task/.next/server/chunks/277.js:5:3371)
at readStandardChunks (/var/task/.next/server/chunks/277.js:5:3698)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async readLines (/var/task/.next/server/chunks/277.js:5:3452)
at async parseJSONStream (/var/task/.next/server/chunks/277.js:5:3058)
}
It works fine locally but doesn’t on vercel. Anyone has an idea?
shikishikichangchang
this works
shikishikichangchang
this fails looks like trpc isn't configured correctly for vercel Interestingly, I set up a new t3 app and deployed to vercel, and this url failed: https://test-one-rust-11.vercel.app/ But this one worked: https://test-d24ql1oom-myname.vercel.app/ this fresh t3 app has no other routes other than hello from trpc
sscotth
sscotth7mo ago
Try to disable Vercel Authentication https://github.com/t3-oss/create-t3-app/issues/1639
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
What if I need vercel authentication? Perhaps I should modify the getUrl function then? And change vercel_url to something else
RILEY BARABASH
RILEY BARABASH7mo ago
Experiencing the same issue.
Ewan Xiao
Ewan Xiao6mo ago
Do we have any updates about this issue? likes @shikishikichangchang , What if I need vercel authentication? How can I do?