Events are not sent in AWS Lambda
See original GitHub issueI have discovered some issues when using SDK on AWS Lambda/API Gateway
The following message is logged to sentry
[HttpGet("/health")]
[ProducesResponseType((int) HttpStatusCode.OK)]
public async Task HealthCheck()
{
_logger.LogCritical("test");
await Task.Delay(TimeSpan.FromSeconds(10));
}
while this does not
[HttpGet("/health")]
[ProducesResponseType((int) HttpStatusCode.OK)]
public IActionResult HealthCheck()
{
_logger.LogCritical("test");
return Ok()
}
The problem might be related to https://github.com/aws/aws-lambda-dotnet/issues/239. The thread is killed right after the response is sent.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:28 (17 by maintainers)
Top Results From Across the Web
Troubleshoot invocation issues in Lambda
Learn how to troubleshoot common invocation issues in Lambda.
Read more >Why can AWS Lambda not read a test event sent to it via ...
I am writing an application on AWS Lambda in Python that expects to receive information that gets placed in the event dictionary. def...
Read more >Lambda Events not triggering EventBridge destination
If you are using Lambda Destination to trigger EventBridge that will not work. The reason is that Lambda Destinations works only for Asynchronous...
Read more >Event captured from AWS lambda are not showing up
Event captured from AWS lambda are not showing up. Hi, I'm using your node sdk to capture events from my backend that runs...
Read more >Event loops and idle connections: why is my lambda not ...
The response isn't sent to the invoker until all event loop tasks are finished. You can configure the runtime to send the response...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Final note regarding the middleware: you should use
context.Response.OnCompleted
instead of flushing afterawait this._next(context);
, otherwise you might miss any event logged after the middleware returns - e.g. middlewares higher in the ASP.NET pipeline, or any error logged by the lambda integration when marshalling the response to API gateway:For non-ASP.NET lambdas, I ended up writing a basic try/catch/finally block in the function:
This all worked for me with 2.0.0-beta4.
I’d suggest using 2.0.0-beta4. The only reason it’s not
2.0.0
(non preview) is that I want to fit some more “breaking” changes in it before but we’re currently busy with a Android SDK so this is on hold.