123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- 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 = {
- introduction: () =>
- tct('In this quick guide you’ll use [strong:npm] or [strong:yarn] to set up:', {
- strong: <strong />,
- }),
- 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 [code:require] or [code:import] statements.',
- {code: <code />}
- ),
- configurations: [
- {
- language: 'javascript',
- description: tct(
- 'Note: You need to call both [code:captureException] and [code:flush] for captured events to be successfully delivered to Sentry.',
- {code: <code />}
- ),
- },
- {
- 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;
|