Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit 82b6b8d

Browse files
committed
fix: add request id check
1 parent 65a2142 commit 82b6b8d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lib/streamer.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,14 @@ const wrapHandler =
5858
* @returns {import("../function/response").Response | Promise<import("../function/response").Response>}
5959
*/
6060
(event, context, callback) => {
61-
const callbackUrl = `https://ntl-functions-streaming.herokuapp.com/.stream/${event.headers['x-nf-request-id']}`
61+
const requestId = event.headers['x-nf-request-id']
62+
if (!requestId) {
63+
return {
64+
statusCode: 422,
65+
body: 'Missing request id',
66+
}
67+
}
68+
const callbackUrl = `https://ntl-functions-streaming.herokuapp.com/.stream/${requestId}`
6269

6370
/** @type {StreamingResponse} */
6471
let res

0 commit comments

Comments
 (0)