fix(lambda): parse empty payload in lambda (#600)

This commit is contained in:
Ricardo Lima authored and GitHub committed 2026-04-25 11:44:18 -05:00
1 parent 5f94b429c2
commit 1b119faf0d
2 files changed
+34 -3

No files matched your search

@@ -90,15 +90,17 @@ public class RuntimeApiServer {
return;
}
inFlight.put(invocation.getRequestId(), invocation);
byte[] payload = invocation.getPayload();
String body = (payload != null && payload.length > 0)
? new String(payload)
: "{}";
ctx.response()
.setStatusCode(200)
.putHeader("Content-Type", "application/json")
.putHeader("Lambda-Runtime-Aws-Request-Id", invocation.getRequestId())
.putHeader("Lambda-Runtime-Invoked-Function-Arn", invocation.getFunctionArn())
.putHeader("Lambda-Runtime-Deadline-Ms", String.valueOf(invocation.getDeadlineMs()))
.end(invocation.getPayload() != null
? new String(invocation.getPayload())
: "{}");
.end(body);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
ctx.response().setStatusCode(204).end();