import {Fragment} from 'react'; import ExternalLink from 'sentry/components/links/externalLink'; import {Layout, LayoutProps} from 'sentry/components/onboarding/gettingStartedDoc/layout'; import {ModuleProps} from 'sentry/components/onboarding/gettingStartedDoc/sdkDocumentation'; import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step'; import {t, tct} from 'sentry/locale'; // Configuration Start const introduction = (

{tct( 'Sentry provides an integration with AWS Lambda ASP.NET Core Server through the Sentry.AspNetCore NuGet package.', { link: , } )}

); export const steps = ({ dsn, sourcePackageRegistries, }: Partial< Pick > = {}): LayoutProps['steps'] => [ { type: StepType.INSTALL, description: t('Add the Sentry dependency:'), configurations: [ { language: 'powershell', partialLoading: sourcePackageRegistries?.isLoading, code: `Install-Package Sentry.AspNetCore -Version ${ sourcePackageRegistries?.isLoading ? t('\u2026loading') : sourcePackageRegistries?.data?.['sentry.dotnet.aspnetcore']?.version ?? '3.34.0' }`, }, { language: 'shell', partialLoading: sourcePackageRegistries?.isLoading, code: `dotnet add package Sentry.AspNetCore -v ${ sourcePackageRegistries?.isLoading ? t('\u2026loading') : sourcePackageRegistries?.data?.['sentry.dotnet.aspnetcore']?.version ?? '3.34.0' }`, }, ], additionalInfo: (

{tct( 'You can combine this integration with a logging library like [strong:log4net, NLog, or Serilog] to include both request data as well as your logs as breadcrumbs. The logging ingrations also capture events when an error is logged.', {strong: } )}

), }, { type: StepType.CONFIGURE, description: (

{tct( 'All [code:ASP.NET Core] configurations are valid here. But one configuration in particular is relevant.', { code: , } )}

{tct( '[code:FlushOnCompletedRequest] ensures all events are flushed out. This is because the general ASP.NET Core hooks for when the process is exiting are not guaranteed to run in a serverless environment. This setting ensures that no event is lost if AWS recycles the process.', { code: , } )}

), configurations: [ { language: 'csharp', code: ` public class LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction { protected override void Init(IWebHostBuilder builder) { builder // Add Sentry .UseSentry(o => { o.Dsn = "${dsn}"; // When configuring for the first time, to see what the SDK is doing: o.Debug = true; // Required in Serverless environments o.FlushOnCompletedRequest = true; // Set TracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. o.TracesSampleRate = 1.0; }) .UseStartup(); } } `, }, ], }, { type: StepType.VERIFY, description: t('You can verify your setup by throwing an exception from a function:'), configurations: [ { language: 'csharp', code: ` [Route("api/[controller]")] public class BadController { [HttpGet] public string Get() => throw null; } `, }, { language: 'shell', description: t('And make a request to that lambda:'), code: 'curl -X GET -I https://url.of.server.aws/api/bad', }, ], additionalInfo: (

{tct( 'Check out the [link:Sentry ASP.NET Core] documentation for the complete set of options.', { link: ( ), } )}

), }, ]; // Configuration End export function GettingStartedAwsLambda({ dsn, sourcePackageRegistries, ...props }: ModuleProps) { return ( ); } export default GettingStartedAwsLambda;