Is there a way to capture AWS API Gateway "x-amzn-requestid" inside .Net Core API Exception filter method?
Asked
Active
Viewed 6,196 times
3
-
1You may need to expand your question to clarify where your code is, in relation to API Gateway. Is your code making calls to an API Gateway API, or is your code being invoked (Lambda) by API Gateway? I suspect the former, but initially assumed the latter. – Michael - sqlbot Dec 13 '18 at 14:51
-
My code is being invoked by API Gateway, I want to capture the request id generated by API Gateway in aws – kjharesh Dec 14 '18 at 04:03
1 Answers
0
The short answer is yes.
Scratch what I said below just use this example-> https://github.com/aws/aws-lambda-dotnet/tree/master/Libraries/src/Amazon.Lambda.APIGatewayEvents
You will see the headers there
var headerNames = string.Join(", ", apigProxyEvent.Headers.Keys);

Fordyce Garfield
- 27
- 7

Mikes3ds
- 592
- 5
- 12
-
How I found the answer. https://github.com/aws/aws-lambda-dotnet/blob/master/Libraries/src/Amazon.Lambda.APIGatewayEvents/APIGatewayProxyRequest.cs https://github.com/aws/aws-lambda-dotnet/blob/master/Libraries/src/Amazon.Lambda.AspNetCoreServer/APIGatewayProxyFunction.cs#L225 – Mikes3ds Dec 21 '18 at 00:00