|
@@ -10,7 +10,6 @@ import ListItem from 'sentry/components/list/listItem';
|
|
|
import {IconWarning} from 'sentry/icons';
|
|
|
import {t, tct, tn} from 'sentry/locale';
|
|
|
import space from 'sentry/styles/space';
|
|
|
-import type {PlatformType} from 'sentry/types';
|
|
|
import {defined} from 'sentry/utils';
|
|
|
import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
|
|
|
import useRouteAnalyticsParams from 'sentry/utils/routeAnalytics/useRouteAnalyticsParams';
|
|
@@ -23,30 +22,14 @@ import {
|
|
|
StacktraceFilenameQuery,
|
|
|
useSourceMapDebugQueries,
|
|
|
} from './useSourceMapDebug';
|
|
|
+import {sourceMapSdkDocsMap} from './utils';
|
|
|
|
|
|
-const platformDocsMap: Record<string, string> = {
|
|
|
- javascript: 'javascript',
|
|
|
- node: 'node',
|
|
|
- 'javascript-react': 'react',
|
|
|
- 'javascript-angular': 'angular',
|
|
|
- // Sending angularjs to angular docs since it's not supported, has limited docs
|
|
|
- 'javascript-angularjs': 'angular',
|
|
|
- // Sending backbone to javascript docs since it's not supported
|
|
|
- 'javascript-backbone': 'javascript',
|
|
|
- 'javascript-ember': 'ember',
|
|
|
- 'javascript-gatsby': 'gatsby',
|
|
|
- 'javascript-vue': 'vue',
|
|
|
- 'javascript-nextjs': 'nextjs',
|
|
|
- 'javascript-remix': 'remix',
|
|
|
- 'javascript-svelte': 'svelte',
|
|
|
-};
|
|
|
-
|
|
|
-const shortPathPlatforms = ['javascript', 'node'];
|
|
|
+const shortPathPlatforms = ['javascript', 'node', 'react-native'];
|
|
|
const sentryInit = <code>Sentry.init</code>;
|
|
|
|
|
|
function getErrorMessage(
|
|
|
error: SourceMapDebugError,
|
|
|
- platform: PlatformType
|
|
|
+ sdkName?: string
|
|
|
): Array<{
|
|
|
title: string;
|
|
|
/**
|
|
@@ -55,9 +38,23 @@ function getErrorMessage(
|
|
|
desc?: string;
|
|
|
docsLink?: string;
|
|
|
}> {
|
|
|
- const docPlatform = platformDocsMap[platform] ?? 'javascript';
|
|
|
+ const docPlatform = (sdkName && sourceMapSdkDocsMap[sdkName]) ?? 'javascript';
|
|
|
const useShortPath = shortPathPlatforms.includes(docPlatform);
|
|
|
|
|
|
+ const baseSourceMapDocsLink = useShortPath
|
|
|
+ ? `https://docs.sentry.io/platforms/${docPlatform}/sourcemaps/`
|
|
|
+ : `https://docs.sentry.io/platforms/javascript/guides/${docPlatform}/sourcemaps/`;
|
|
|
+
|
|
|
+ function getTroubleshootingLink(section?: string) {
|
|
|
+ // react-native has a different troubleshooting page
|
|
|
+ if (docPlatform === 'react-native') {
|
|
|
+ return 'https://docs.sentry.io/platforms/react-native/troubleshooting/#source-maps';
|
|
|
+ }
|
|
|
+ return `${baseSourceMapDocsLink}troubleshooting_js/` + (section ? `#${section}` : '');
|
|
|
+ }
|
|
|
+
|
|
|
+ const defaultDocsLink = `${baseSourceMapDocsLink}#uploading-source-maps-to-sentry`;
|
|
|
+
|
|
|
switch (error.type) {
|
|
|
case SourceMapProcessingIssueType.MISSING_RELEASE:
|
|
|
return [
|
|
@@ -66,9 +63,7 @@ function getErrorMessage(
|
|
|
desc: t(
|
|
|
'Integrate Sentry into your release pipeline. You can do this with a tool like Webpack or using the CLI.'
|
|
|
),
|
|
|
- docsLink: useShortPath
|
|
|
- ? `https://docs.sentry.io/platforms/${docPlatform}/configuration/options/#release`
|
|
|
- : `https://docs.sentry.io/platforms/javascript/guides/${docPlatform}/configuration/options/#release`,
|
|
|
+ docsLink: defaultDocsLink,
|
|
|
},
|
|
|
];
|
|
|
case SourceMapProcessingIssueType.PARTIAL_MATCH:
|
|
@@ -79,25 +74,23 @@ function getErrorMessage(
|
|
|
error.data.absPath,
|
|
|
error.data.partialMatchPath
|
|
|
),
|
|
|
- docsLink: useShortPath
|
|
|
- ? `https://docs.sentry.io/platforms/${docPlatform}/sourcemaps/troubleshooting_js/#verify-artifact-names-match-stack-trace-frames`
|
|
|
- : `https://docs.sentry.io/platforms/javascript/guides/${docPlatform}/sourcemaps/troubleshooting_js/#verify-artifact-names-match-stack-trace-frames`,
|
|
|
+ docsLink: getTroubleshootingLink(
|
|
|
+ 'verify-artifact-names-match-stack-trace-frames'
|
|
|
+ ),
|
|
|
},
|
|
|
];
|
|
|
case SourceMapProcessingIssueType.MISSING_USER_AGENT:
|
|
|
return [
|
|
|
{
|
|
|
- title: t('Event has Release but no User-Agent'),
|
|
|
+ title: t('Sentry not part of release pipeline'),
|
|
|
desc: tct(
|
|
|
- 'Integrate Sentry into your release pipeline. You can do this with a tool like Webpack or using the CLI. Please note the release must be the same as being set in your [init]. The value for this event is [version]',
|
|
|
+ 'Integrate Sentry into your release pipeline. You can do this with a tool like Webpack or using the CLI. Please note the release must be the same as being set in your [init]. The value for this event is [version].',
|
|
|
{
|
|
|
init: sentryInit,
|
|
|
- version: error.data.version,
|
|
|
+ version: <code>{error.data.version}</code>,
|
|
|
}
|
|
|
),
|
|
|
- docsLink: useShortPath
|
|
|
- ? `https://docs.sentry.io/platforms/${docPlatform}/sourcemaps/#uploading-source-maps-to-sentry`
|
|
|
- : `https://docs.sentry.io/platforms/javascript/guides/${docPlatform}/sourcemaps/#uploading-source-maps-to-sentry`,
|
|
|
+ docsLink: defaultDocsLink,
|
|
|
},
|
|
|
];
|
|
|
case SourceMapProcessingIssueType.MISSING_SOURCEMAPS:
|
|
@@ -107,9 +100,7 @@ function getErrorMessage(
|
|
|
desc: t(
|
|
|
'It looks like you are creating but not uploading your source maps. Please refer to the instructions in our docs guide for help with troubleshooting the issue.'
|
|
|
),
|
|
|
- docsLink: useShortPath
|
|
|
- ? `https://docs.sentry.io/platforms/${docPlatform}/sourcemaps/`
|
|
|
- : `https://docs.sentry.io/platforms/javascript/guides/${docPlatform}/sourcemaps/`,
|
|
|
+ docsLink: defaultDocsLink,
|
|
|
},
|
|
|
];
|
|
|
case SourceMapProcessingIssueType.URL_NOT_VALID:
|
|
@@ -117,12 +108,15 @@ function getErrorMessage(
|
|
|
{
|
|
|
title: t('Invalid Absolute Path URL'),
|
|
|
desc: tct(
|
|
|
- 'The abs_path of the stack frame has [absPath] which is not a valid URL. Please refer to the instructions in our docs guide for help with troubleshooting the issue.',
|
|
|
- {absPath: <code>{error.data.absPath}</code>}
|
|
|
+ 'The given [literalAbsPath] of the stack frame is [absPath] which is not a valid URL. Please refer to the instructions in our docs guide for help with troubleshooting the issue.',
|
|
|
+ {
|
|
|
+ absPath: <code>{error.data.absPath}</code>,
|
|
|
+ literalAbsPath: <code>abs_path</code>,
|
|
|
+ }
|
|
|
+ ),
|
|
|
+ docsLink: getTroubleshootingLink(
|
|
|
+ 'verify-artifact-names-match-stack-trace-frames'
|
|
|
),
|
|
|
- docsLink: useShortPath
|
|
|
- ? `https://docs.sentry.io/platforms/${docPlatform}/sourcemaps/troubleshooting_js/#verify-artifact-names-match-stack-trace-frames`
|
|
|
- : `https://docs.sentry.io/platforms/javascript/guides/${docPlatform}/sourcemaps/troubleshooting_js/#verify-artifact-names-match-stack-trace-frames`,
|
|
|
},
|
|
|
];
|
|
|
case SourceMapProcessingIssueType.NO_URL_MATCH:
|
|
@@ -130,12 +124,15 @@ function getErrorMessage(
|
|
|
{
|
|
|
title: t('Absolute Path Mismatch'),
|
|
|
desc: tct(
|
|
|
- 'The [absPath] of the stack frame doesn’t match any release artifact. Please refer to the instructions in our docs guide for help with troubleshooting the issue.',
|
|
|
- {absPath: <code>{error.data.absPath}</code>}
|
|
|
+ "The given [literalAbsPath] of the stack frame is [absPath] which doesn't match any release artifact. Please refer to the instructions in our docs guide for help with troubleshooting the issue.",
|
|
|
+ {
|
|
|
+ absPath: <code>{error.data.absPath}</code>,
|
|
|
+ literalAbsPath: <code>abs_path</code>,
|
|
|
+ }
|
|
|
+ ),
|
|
|
+ docsLink: getTroubleshootingLink(
|
|
|
+ 'verify-artifact-names-match-stack-trace-frames'
|
|
|
),
|
|
|
- docsLink: useShortPath
|
|
|
- ? `https://docs.sentry.io/platforms/${docPlatform}/sourcemaps/troubleshooting_js/#verify-artifact-names-match-stack-trace-frames`
|
|
|
- : `https://docs.sentry.io/platforms/javascript/guides/${docPlatform}/sourcemaps/troubleshooting_js/#verify-artifact-names-match-stack-trace-frames`,
|
|
|
},
|
|
|
];
|
|
|
case SourceMapProcessingIssueType.DIST_MISMATCH:
|
|
@@ -143,12 +140,16 @@ function getErrorMessage(
|
|
|
{
|
|
|
title: t('Absolute Path Mismatch'),
|
|
|
desc: tct(
|
|
|
- 'The distribution identifier you are providing doesn’t match. The [dist] value configured in your [init] must be the same as the one used during source map upload. Please refer to the instructions in our docs guide for help with troubleshooting the issue.',
|
|
|
- {init: sentryInit, dist: <code>dist</code>}
|
|
|
+ "The distribution identifier you are providing doesn't match. The [literalDist] value of [dist] configured in your [init] must be the same as the one used during source map upload. Please refer to the instructions in our docs guide for help with troubleshooting the issue.",
|
|
|
+ {
|
|
|
+ init: sentryInit,
|
|
|
+ dist: <code>dist</code>,
|
|
|
+ literalDist: <code>dist</code>,
|
|
|
+ }
|
|
|
+ ),
|
|
|
+ docsLink: getTroubleshootingLink(
|
|
|
+ 'verify-artifact-distribution-value-matches-value-configured-in-your-sdk'
|
|
|
),
|
|
|
- docsLink: useShortPath
|
|
|
- ? `https://docs.sentry.io/platforms/${docPlatform}/sourcemaps/troubleshooting_js/#verify-artifact-names-match-stack-trace-frames`
|
|
|
- : `https://docs.sentry.io/platforms/javascript/guides/${docPlatform}/sourcemaps/troubleshooting_js/#verify-artifact-names-match-stack-trace-frames`,
|
|
|
},
|
|
|
];
|
|
|
case SourceMapProcessingIssueType.UNKNOWN_ERROR:
|
|
@@ -203,7 +204,7 @@ function ExpandableErrorList({
|
|
|
|
|
|
function combineErrors(
|
|
|
response: Array<SourceMapDebugResponse | undefined | null>,
|
|
|
- platform: PlatformType
|
|
|
+ sdkName?: string
|
|
|
) {
|
|
|
const combinedErrors = uniqBy(
|
|
|
response
|
|
@@ -214,7 +215,7 @@ function combineErrors(
|
|
|
);
|
|
|
const errors = combinedErrors
|
|
|
.map(error =>
|
|
|
- getErrorMessage(error, platform).map(message => ({...message, type: error.type}))
|
|
|
+ getErrorMessage(error, sdkName).map(message => ({...message, type: error.type}))
|
|
|
)
|
|
|
.flat();
|
|
|
|
|
@@ -226,17 +227,17 @@ interface SourcemapDebugProps {
|
|
|
* A subset of the total error frames to validate sourcemaps
|
|
|
*/
|
|
|
debugFrames: StacktraceFilenameQuery[];
|
|
|
- platform: PlatformType;
|
|
|
+ sdkName?: string;
|
|
|
}
|
|
|
|
|
|
-export function SourceMapDebug({debugFrames, platform}: SourcemapDebugProps) {
|
|
|
+export function SourceMapDebug({debugFrames, sdkName}: SourcemapDebugProps) {
|
|
|
const organization = useOrganization();
|
|
|
const results = useSourceMapDebugQueries(debugFrames.map(debug => debug.query));
|
|
|
|
|
|
const isLoading = results.every(result => result.isLoading);
|
|
|
const errorMessages = combineErrors(
|
|
|
results.map(result => result.data).filter(defined),
|
|
|
- platform
|
|
|
+ sdkName
|
|
|
);
|
|
|
|
|
|
useRouteAnalyticsParams({
|
|
@@ -248,17 +249,17 @@ export function SourceMapDebug({debugFrames, platform}: SourcemapDebugProps) {
|
|
|
}
|
|
|
|
|
|
const handleDocsClick = (type: SourceMapProcessingIssueType) => {
|
|
|
- trackAdvancedAnalyticsEvent('growth.sourcemap_docs_clicked', {
|
|
|
+ trackAdvancedAnalyticsEvent('source_map_debug.docs_link_clicked', {
|
|
|
organization,
|
|
|
- platform,
|
|
|
+ sdkName,
|
|
|
type,
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const handleExpandClick = (type: SourceMapProcessingIssueType) => {
|
|
|
- trackAdvancedAnalyticsEvent('growth.sourcemap_expand_clicked', {
|
|
|
+ trackAdvancedAnalyticsEvent('source_map_debug.expand_clicked', {
|
|
|
organization,
|
|
|
- platform,
|
|
|
+ sdkName,
|
|
|
type,
|
|
|
});
|
|
|
};
|
|
@@ -294,8 +295,8 @@ export function SourceMapDebug({debugFrames, platform}: SourcemapDebugProps) {
|
|
|
}
|
|
|
>
|
|
|
{tn(
|
|
|
- 'We’ve encountered %s problem de-minifying your applications source code!',
|
|
|
- 'We’ve encountered %s problems de-minifying your applications source code!',
|
|
|
+ "We've encountered %s problem de-minifying your applications source code!",
|
|
|
+ "We've encountered %s problems de-minifying your applications source code!",
|
|
|
errorMessages.length
|
|
|
)}
|
|
|
</Alert>
|