import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step'; import type { Docs, DocsParams, OnboardingConfig, } from 'sentry/components/onboarding/gettingStartedDoc/types'; import {getUploadSourceMapsStep} from 'sentry/components/onboarding/gettingStartedDoc/utils'; import { getCrashReportJavaScriptInstallStep, getCrashReportModalConfigDescription, getCrashReportModalIntroduction, } from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding'; import {getJSServerMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding'; import {t, tct} from 'sentry/locale'; import {getInstallConfig, getSdkInitSnippet} from 'sentry/utils/gettingStartedDocs/node'; type Params = DocsParams; const getSdkSetupSnippet = (params: Params) => ` "use strict"; // IMPORTANT: Make sure to import and initialize Sentry at the top of your file. ${getSdkInitSnippet(params, 'node')} // Place any other require/import statements here module.exports = async function (context, req) { try { await notExistFunction(); } catch (e) { Sentry.captureException(e); await Sentry.flush(2000); } context.res = { status: 200, body: "Hello from Azure Cloud Function!", }; }; `; const onboarding: OnboardingConfig = { install: params => [ { type: StepType.INSTALL, description: t('Add the Sentry Node SDK as a dependency:'), configurations: getInstallConfig(params), }, ], configure: params => [ { type: StepType.CONFIGURE, description: tct( 'Ensure that Sentry is imported and initialized at the beginning of your file, prior to any other [require:require] or [import:import] statements.', {import: , require: } ), configurations: [ { language: 'javascript', description: tct( 'Note: You need to call both [captureExceptionCode:captureException] and [flushCode:flush] for captured events to be successfully delivered to Sentry.', {captureExceptionCode: , flushCode: } ), }, { language: 'javascript', code: getSdkSetupSnippet(params), }, ], }, getUploadSourceMapsStep({ guideLink: 'https://docs.sentry.io/platforms/javascript/guides/azure-functions/sourcemaps/', ...params, }), ], verify: () => [], }; const crashReportOnboarding: OnboardingConfig = { introduction: () => getCrashReportModalIntroduction(), install: (params: Params) => getCrashReportJavaScriptInstallStep(params), configure: () => [ { type: StepType.CONFIGURE, description: getCrashReportModalConfigDescription({ link: 'https://docs.sentry.io/platforms/javascript/guides/azure-functions/user-feedback/configuration/#crash-report-modal', }), }, ], verify: () => [], nextSteps: () => [], }; const docs: Docs = { onboarding, customMetricsOnboarding: getJSServerMetricsOnboarding(), crashReportOnboarding, }; export default docs;