Skip to content

Commit 5adbe5c

Browse files
committed
fix: stringify response headers as ALB expects response headers to be type string
This was identified through using express within AWS Lambda which returns content-length header as a number which causes ALB to throw a 502 bad gateway exception. This change fixes this issue.
1 parent 5944638 commit 5adbe5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/event-sources/aws/alb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const getResponseToAlb = ({
5252
const multiValueHeaders = !event.headers ? getMultiValueHeaders({ headers: responseHeaders }) : undefined
5353
const headers = event.headers
5454
? Object.entries(responseHeaders).reduce((acc, [k, v]) => {
55-
acc[k] = Array.isArray(v) ? v[0] : v
55+
acc[k] = Array.isArray(v) ? String(v[0]) : String(v)
5656
return acc
5757
}, {})
5858
: undefined

0 commit comments

Comments
 (0)