Sub Documents

AWS Lambdaを使う


 はじめてLambdaを使う際は、読んでも意味が全くわからないけれど全部一読すべきドキュメントになっています。AWS Lambda デベロッパーガイドを全部読んでから初めましょう。ここではLaravelのコンテナをLambdaで利用する方法について解説しています。Laravelについてはサーバーレス LAMP スタック – Part 4: サーバーレス Laravel アプリの構築に寄稿が合ったので読んでおくとよいと思います。

関数の設定

AWSコンソールのLambdaのトップページ行きましょう。まだ何も関数が設定していなければ0(ゼロ)になっていると思います。

{
    "errorType": "Bref\\Event\\InvalidLambdaEvent",
    "errorMessage": "This handler expected to be invoked with a API Gateway or ALB event. Instead, the handler was invoked with invalid event data: Array\n(\n    [key1] => value1\n    [key2] => value2\n    [key3] => value3\n)\n",
    "stack": [
        "#0 /var/task/vendor/bref/bref/src/Event/Http/HttpHandler.php(23): Bref\\Event\\Http\\HttpRequestEvent->__construct()",
        "#1 /var/task/vendor/bref/bref/src/Runtime/Invoker.php(29): Bref\\Event\\Http\\HttpHandler->handle()",
        "#2 /var/task/vendor/bref/bref/src/Runtime/LambdaRuntime.php(91): Bref\\Runtime\\Invoker->invoke()",
        "#3 /var/runtime/bootstrap(55): Bref\\Runtime\\LambdaRuntime->processNextEvent()",
        "#4 {main}"
    ]
}

ここですね。

This handler expected to be invoked with a API Gateway or ALB event. Instead, the handler was invoked with invalid event data: Array