Skip to content

Commit dfdbc55

Browse files
committed
When sending a response, cat the file to stdin instead of trying to pass the whole thing to the -d flag in curl
1 parent 5a9c3bf commit dfdbc55

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bootstrap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ sendRuntimeError () {
3030
# Send successful response to Lambda API
3131
sendResponse () {
3232
REQUEST_ID=$1
33-
REQUEST_RESPONSE=$2
34-
curl -sS -X POST -d "$REQUEST_RESPONSE" "http://${AWS_LAMBDA_RUNTIME_API}/${RUNTIME_PATH}/invocation/${REQUEST_ID}/response" > /dev/null
33+
REQUEST_RESPONSE_FILE=$2
34+
cat $REQUEST_RESPONSE_FILE | curl -sS -X POST -d @- "http://${AWS_LAMBDA_RUNTIME_API}/${RUNTIME_PATH}/invocation/${REQUEST_ID}/response" > /dev/null
3535
}
3636

3737
# Make sure handler file exists
@@ -76,7 +76,7 @@ do
7676
EXIT_CODE=$?
7777
# Respond to Lambda API
7878
if [[ $EXIT_CODE -eq "0" ]]; then
79-
sendResponse "$REQUEST_ID" "$(cat $RESPONSE)"
79+
sendResponse "$REQUEST_ID" "$RESPONSE"
8080
else
8181
# Log error to stdout as well
8282
cat $RESPONSE

0 commit comments

Comments
 (0)