Vercel deployment: [cause]: SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON
I'm unsure where the error lies, but I'm getting
[cause]: SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON
During deployments on Vercel. This happens during the Generate Static Asssets step.
I think this comes from:
This function getting VERCEL_URL while it's not available when making the tRPC call. I know because it's actually not hitting the tRPC backend and failing before that.
What I don't understand is why is this not an issue for everyone?6 Replies
So I can reproduce this on the base create t3 app.
Why does removing
Cause the server to crash on build? What in the world is happening here?
Fuck sake i'ts the await ins't it?
The requests expected json but got html
Some middleware is either redirecting or sending html back when it should have json as a return
@m1aw can you show me you root layout.tsx? sometimes if you wrap ur root html tag with a provider like trpc provider or any other it crashes like this
Oh
This is the root provider that's default with t3
What are you menat to do instead?
well... my suspicions were wrong 😅
you are doing it correctly
Yeah, couldn't figure out what was going on, might open a bug report later, since I can reproduce on the t3 setup by default.
No idea tbh, but for now just making a random tRPC request before fixes the issues so that's what we are going to roll with.