I am streaming response from the deployment events endpoint:
https://api.vercel.com/v3/deployments/{urlOrId}/events?limit=-1&follow=1
CURRENT BEHAVIOR
Reading the response, never receives “done”. The request stays open even after the deployment has finished.
EXPECTED BEHAVIOR
When the deployment is finished, the server should close the readable stream.
const response = await fetch(
`https://api.vercel.com/v3/deployments/${urlOrId}/events?limit=-1&follow=1`,
{
headers: {
Authorization: `Bearer ${token}`,
},
},
);
const reader = response.body?.getReader();
if (reader) {
while (true) {
const { done, value } = await reader.read();
if (done) {
// TODO: never happens?
break;
}
const next = new TextDecoder().decode(value);
setText((prev) => prev + next);
}
}
NextJS 15, React 19, deployed on Vercel and occurs in all environments development/preview/production