aws / aws/aws-lambda-dotnet

The statusDescription header must contain the status code and reason phrase, separated by a single space -- ALB returning 502 from Lambda

オープン
#507 コメント 12 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature-request module/aspnetcore-support p2 queued
主要言語
C#
スター
1.7k
フォーク
503
平均マージ
1日 18時間
マージ済み PR(30日)
21

説明

I've created a Lambda that check on a DynamoDB table the existence of a record matching host and request path and, if found, returns a redirect to the matching URL.

My Lambda returns this response but the ALB returns 502.

{
    "statusCode": 301,
    "statusDescription": null,
    "headers": {
        "Location": "https://www.my-target.co.uk/"
    },
    "multiValueHeaders": null,
    "body": "Redirecting to https://www.my-target.co.uk/",
    "isBase64Encoded": false
}

This is the log I find in CloudWatch for the Lambda function

START RequestId: 8b5a28f2-c56d-4418-a7b9-66ebe0ba2470 Version: $LATEST
[Information] EMG.ApplicationLoadBalancerRequestHandler: Received: GET / 
[Information] EMG.ApplicationLoadBalancerRequestHandler: Processing: my-test.net / 
[Information] EMG.RedirectManagers.RedirectTableRedirectManager: Fetching item: my-test.net / from table redirect-table 
[Information] EMG.ApplicationLoadBalancerRequestHandler: Found: https://www.target.co.uk/ Permanent 
END RequestId: 8b5a28f2-c56d-4418-a7b9-66ebe0ba2470
REPORT RequestId: 8b5a28f2-c56d-4418-a7b9-66ebe0ba2470	Duration: 69.59 ms	Billed Duration: 100 ms Memory Size: 128 MB	Max Memory Used: 39 MB	

This is the response I get

HTTP/1.1 502
status: 502
Server: awselb/2.0
Date: Thu, 15 Aug 2019 19:13:58 GMT
Content-Type: text/html
Content-Length: 138
Connection: keep-alive
<html>
 <head><title>502 Bad Gateway</title></head>
 <body bgcolor="white">
 <center><h1>502 Bad Gateway</h1></center>
 </body>
 </html>

I couldn't find anything saying we can't return non-200 responses from Lambda, so I really have no idea...

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

AWS Application Load Balancer Lambda response contract と提供された response から始め、null statusDescription と 301 redirect に注目してください。この repository が statusCode と statusDescription をどのように処理しているかを追跡し、そのうえで必要な status-code/reason-phrase 形式と、それによって生じる non-200 response の動作を確認してください。

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

評価

技術スタック
aws, csharp
領域
backend-api-design, cloud
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

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

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