An Azure service that provides an event-driven serverless compute platform.
Hello Theja Aragonda,
Yes — this is an expected behavioral difference between v3 and v4, and it stems from internal changes in how the response pipeline serializes headers rather than a functional regression.
Behavior difference between v3 and v4
v3 behavior:
Headers with value undefined were not serialized into the final HTTP response.
Result:
→ Missing/undefined headers were silently omitted.
v4 behavior:
The runtime now preserves header keys even when the value is undefined.
During serialization, undefined is converted into the string "undefined".
Result:
→ Header appears in the response instead of being omitted.
This change is caused by:
Updated HTTP response handling in the v4 runtime
Alignment with JavaScript object serialization semantics
More explicit header visibility for debugging/inspection
So yes — this is known and expected behavior, not a defect.
Recommended approach in v4
To restore v3-style omission behavior, headers must be filtered before sending the response.
Option 1 – Remove undefined headers explicitly:
const cleanedHeaders = Object.fromEntries(
Object.entries(headers).filter(([_, v]) => v !== undefined)
);
return {
status: 200,
headers: cleanedHeaders,
body: responseBody
};
Option 2 – Set null instead of undefined
'page-token': null
Please accept as answer and do a Thumbs-up to upvote this response if you are satisfied with the community help. Your upvote will be beneficial for the community users facing similar issues.