sentry-dotnet
sentry-dotnet copied to clipboard
Exceptions from AWS Lambda not making it to Sentry project
Package
Sentry.AspNetCore
.NET Flavor
.NET Core
.NET Version
6.0.6
OS
Other
SDK Version
Assembly Sentry, Version=3.20.1.0
Self-Hosted Sentry Version
No response
Steps to Reproduce
- Initialization
protected override void Init(IWebHostBuilder builder)
{
builder.UseSentry(o =>
{
o.Dsn = sentryDsn;
o.Debug = true;
o.FlushOnCompletedRequest = true;
o.FlushTimeout = TimeSpan.FromSeconds(sentryFlushTimeout);
o.TracesSampleRate = 1.0;
o.ConfigureScope(scope =>
{
scope.SetTag("lambda", _sentryTag);
});
});
builder.UseStartup<Startup>();
}
- Capture Event
protected Guid? CaptureEvent(Exception? ex)
{
return Sentry.SentrySdk.CaptureEvent(new Sentry.SentryEvent(ex));
}
- Cloudwatch log shows these entries in the event of an exception:
2022-07-28T14:38:46.720Z 5619f8f9-... [Information] Sentry.ISentryClient: Capturing event.
2022-07-28T14:38:47.400Z 5619f8f9-... [Information] Sentry.ISentryClient: Envelope queued up: 'd498d...'
Expected Result
Expect to see the exceptions captured in the Sentry project, not seeing them.
Am seeing some events captured from previous days so I know Sentry is at least intermittently functional.
Currently adding tagging, should see the exception being tagged.
Actual Result
Have exceptions in the project from 2 days ago but not today when I triggered the error.
I'll take another look. Thanks for reporting.
Hi @mattjohnsonpint , any more info on this? Is there any more logging / debugging I can do to troubleshoot? Thanks!
Sorry, been swamped - but I will look again soon. Thanks for the reminder.
@mattjohnsonpint - more info that might be helpful - Seems that the Sentry client is arbitrarily exiting before the lambda does:
2022-08-15T15:20:40.655Z febe7822-14d9-48f9-a8c9-02c204de867d
[Information] Sentry.ISentryClient: Shutdown token triggered. Time to exit. #1 in queue.
When the exceptions are successfully making it over then you see something like this:
2022-08-15T12:13:02.136Z d7a84002-9c82-446f-a0b1-53d05cce481a
[Information] Sentry.ISentryClient: Envelope 'd5a90b...' successfully received by Sentry.
In either case, the entry is preceded by these two log entries consistently:
[Information] Sentry.ISentryClient: Capturing event.
[Information] Sentry.ISentryClient: Envelope queued up: 'd5a90b...'
@dr3x - could I get the whole block please? Everything logged from sentry for a single function request including the shutdown, with timestamps visible if possible. You can redact anything sensitive. Thanks.
@mattjohnsonpint any more info on this from the logs I sent? Thanks
I'm sorry, but after spending several more hours trying to reproduce this, I am unable. In all cases - events make it to sentry fine. I never get the Shutdown token triggered. Time to exit.
message.
If you can create a repro, I'll investigate further. But at this point I'm at a loss.
I would need a complete repro - meaning a dotnet lambda app that I can compile and deploy to AWS that has the issue. The MRE guidance from Stack Overflow would be useful to follow.
Closing for now, but I'll re-open if you are able to provide a complete repro. Thanks.
Thanks @mattjohnsonpint I'll work on getting you a MRE to reproduce