Next.js Discord

Discord Forum

Next.js API Routes behaving differently on Vercel

Avatar
I have this code and if I run it locally (dev and build) I can see the status text, but if I host it on Vercel I just get BAD REQUEST
Image
Image
Image
Answered by Rafael Almeida
afaik HTTP2 does not support the statusText: https://developer.mozilla.org/en-US/docs/Web/API/Response/statusText#value. if you want to provide a status code you should do that in the response body
View full answer

20 Replies

Answer
And why is Vercel using HTTP2? Im not so much into these protocols but isnt 3 the latest version?
Avatar
the dev server uses HTTP/1.1, idk why Vercel doesn't support HTTP/3 but I assume its not a trivial change
Avatar
Ok, thats weird that everything uses a different http version
Avatar
network tab of the devtools in the browser
Avatar
@Rafael Almeida network tab of the devtools in the browser
Avatar
But this behaviour is not written down in some Next.js or Vercel docs?
Avatar
what behavior?
Avatar
That local it is using HTTP 1.1 and deployed HTTP 2
It has to be written down somewhere? Otherwise I expect it to be the same
Or am I completely wrong here?
Avatar
the http protocol is usually a responsibility of the infra hosting the app, you don't really care about it when developing locally
I am not very familiar with their differences so I don't know why every dev tool stays on 1.1 but that's just how it works nowadays
Avatar
@FleetAdmiralJakob 🗕 🗗 🗙 cannot find it in the network tab
Avatar
it's on the columns for the requests list, if you don't see it you need to right click and check the protocol so it shows up. I'm on a bus so I can't send a ss
Avatar
found it
Image
Thank you really much for your help! Without you I would never came to the conclusion that this is a problem of the HTTP Versions
Avatar
no problem :blobthumbsup: