← All platforms

AWS Lambda (.NET) error tracking

An API can run on Lambda and still have a home for its exceptions. Connect the Sentry .NET SDK to Telebugs and keep the reports on your server.

~/hoofnotes  dotnet add package Sentry.AspNetCore
~/hoofnotes  nvim LambdaEntryPoint.cs
using Microsoft.AspNetCore.Hosting;
public class LambdaEntryPoint
: Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction
{
protected override void Init(IWebHostBuilder builder)
{
builder.UseSentry(options =>
{
// Copy the complete DSN, key and path included.
options.Dsn = "YOUR_TELEBUGS_DSN";
options.FlushOnCompletedRequest = true;
}).UseStartup<Startup>();
}
}
~/hoofnotes  dotnet build

Space pauses or resumes. R replays. Escape shows the complete setup.

Hang on, I already use Sentry

Keep Sentry.AspNetCore and change its destination to your Telebugs DSN. Your error reports stay on your server. You don’t need a Sentry account.

Is this for an ASP.NET Core API on Lambda?

Yes. The example uses the ASP.NET Core integration with Lambda’s API Gateway host. A plain Lambda handler can report exceptions through the base .NET SDK instead.

Will the report survive the function stopping?

Once Telebugs receives it, yes. The SDK needs time to send it first. The request-completion option handles that for the API hosting setup shown here.