Next.js Discord

Discord Forum

Next.js API Routes behaving differently on Vercel

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
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?
the dev server uses HTTP/1.1, idk why Vercel doesn't support HTTP/3 but I assume its not a trivial change
Ok, thats weird that everything uses a different http version
network tab of the devtools in the browser
@Rafael Almeida network tab of the devtools in the browser
But this behaviour is not written down in some Next.js or Vercel docs?
what behavior?
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?
@Rafael Almeida network tab of the devtools in the browser
cannot find it in the network tab
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
@FleetAdmiralJakob 🗕 🗗 🗙 cannot find it in the network tab
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
found it
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
no problem :blobthumbsup: