aws / aws/aws-lambda-runtime-interface-emulator

Emulate API Gateway payload in event object

オープン
#64 コメント 4 件 リアクション 11 件 担当者 0 名 GitHub で見る
主要言語
Go
スター
1.1k
フォーク
118
平均マージ
42分
マージ済み PR(30日)
2

説明

We run our lambdas behind an API Gateway. The event object in the lambda when we run locally does not have the same structure as the event object when running behind an API Gateway.

For example, if I want to post to a path with the `/{model}` parameter, I need to post with this wrapping my payload
```
{
"pathParameters": {
"model": model
},
"body": { .. json payload ...}
}
```
When I call my API Gateway endpoint I do not need to wrap the payload, as this is created by API Gateway as it passes the payload off to the lambda.

What I would really like is to be able to set an ENV var such as `LAMBDA_MODE` which when set to `API_GATEWAY` RIE wraps the event to mimic the event passed by the API Gateway. It would need to work the same for response objects too. If not set, then it would work in the default mode which is how it works today.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、エミュレーターが現在どのようにイベントオブジェクトを受け取り、構築しているかを追跡し、次にレスポンス経路を調べます。その動作を、ここで説明されている API Gateway の構造と比較し、LAMBDA_MODE=API_GATEWAY 設定がリクエストとレスポンスの処理の両方にどのような影響を与えるべきかを判断します。デフォルトの動作が変更されず、API Gateway 形式のイベントとレスポンスがサポートされれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
go
領域
api, backend
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。