Skip to content

Commit 1a53b92

Browse files
committed
Cast event to an array when reading
Fixes #31
1 parent af46fd4 commit 1a53b92

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ AWS Lambda change log
33

44
## ?.?.? / ????-??-??
55

6+
* Fixed issze #31: Event is not always an array (when using JSON library
7+
6.0+, see https://github.com/xp-forge/json/pull/18
8+
(@thekid)
69
* Fixed issue #29: Implicitly marking parameter as nullable is deprecated
710
(@thekid)
811

src/main/php/xp/lambda/AwsRunner.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static function main($args) {
6262
try {
6363
$r= $api->receive('invocation/next');
6464
$context= new Context($r->headers(), $variables);
65-
$event= 0 === $context->payloadLength ? null : Json::read(new StreamInput($r->in()));
65+
$event= 0 === $context->payloadLength ? null : (array)Json::read(new StreamInput($r->in()));
6666

6767
$lambda->invoke($event, $context);
6868
} catch (Throwable $t) {

0 commit comments

Comments
 (0)