CodeGenieApp / CodeGenieApp/serverless-express

[Bug] API Gateway v2 cookies response should be array

オープン
#388 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
5.3k
フォーク
674
PR マージ指標
30日以内にマージされた PR はありません

説明

According to API Gateway v2 payload 2.0 docs (https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html) the 'cookies' should be array.
And below code is current handling logic for it.

https://github.com/vendia/serverless-express/blob/671f914429e9708bfb1ee6ba76b5947a917592df/src/event-sources/aws/api-gateway-v2.js#L65-L67

However, with the latest express (v4.17.1).
When user set cookie using `res.cookie(name, value)`, it set 'set-cookie' header as string at first time.
and convert it as array when using `res.cookie(name, value)` more than once.

So, we should insert Array check logic, and convert it to array when it is not.

Plus,
If we didn't delete 'set-cookie' header in response, API gateway send 'set-cookie' header twice.
So, for gateway v2 and payload 2.0 we should delete 'set-cookie' header field.

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

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

調査の方向性

src/event-sources/aws/api-gateway-v2.js のリンクされた処理ロジックから始め、Express が1つの cookie を設定する場合と複数の cookie を設定する場合のレスポンス動作を比較します。完了条件は、API Gateway v2 が cookies を配列として受け取り、元の set-cookie ヘッダーが削除されて二重に送信されないことです。

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

評価

技術スタック
aws, express, javascript
領域
api, backend, cloud
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

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

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