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

Offen
#507 12 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
feature-request module/aspnetcore-support p2 queued
Vorherrschende Sprache
C#
Sterne
1.7k
Forks
503
Ø Merge
1 T. 13 Std.
Gemergte PRs (30 T.)
19

Beschreibung

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

502 Bad Gateway

502 Bad Gateway




```

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit dem AWS Application Load Balancer Lambda response contract und der bereitgestellten response, mit Fokus auf null statusDescription und den 301 redirect. Verfolgen Sie, wie dieses Repository statusCode und statusDescription behandelt, und überprüfen Sie anschließend das erforderliche Statuscode/Reason-Phrase-Format sowie das daraus resultierende Verhalten bei einer non-200 response.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
aws, csharp
Bereich
backend-api-design, cloud
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.