Skip to content

Commit 349a466

Browse files
author
Stephen Cefali
authored
feat(source-maps): adds new case for source map debugging (#49061)
This PR adds a new source map debugging strategy for an outdated SDK: ![Screen Shot 2023-05-12 at 3 53 39 PM](https://github.com/getsentry/sentry/assets/8533851/6a664d2c-1ce7-44b0-bb6e-b4007744c0db) We ask them to upgrade and if they are a major revision out of date, we expose the migration guide. A backend PR will be added later to generate this response.
1 parent 9354001 commit 349a466

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

static/app/components/events/interfaces/crashContent/exception/sourceMapDebug.tsx

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ function getErrorMessage(
5454
}
5555
return `${baseSourceMapDocsLink}troubleshooting_js/` + (section ? `#${section}` : '');
5656
}
57+
function getMigrationGuide() {
58+
if (docPlatform === 'react-native') {
59+
return 'https://docs.sentry.io/platforms/react-native/migration/';
60+
}
61+
return 'https://github.com/getsentry/sentry-javascript/blob/develop/MIGRATION.md#upgrading-from-6x-to-7x';
62+
}
5763

5864
const defaultDocsLink = `${baseSourceMapDocsLink}#uploading-source-maps-to-sentry`;
5965

@@ -168,6 +174,18 @@ function getErrorMessage(
168174
docsLink: getTroubleshootingLink(),
169175
},
170176
];
177+
case SourceMapProcessingIssueType.SDK_OUT_OF_DATE:
178+
return [
179+
{
180+
title: t('SDK Out of Date'),
181+
desc: t(
182+
"We're not able to un-minify your application's source code, because your SDK %s is out of date with version %s. Please update it to the latest version.",
183+
error.data.sdkName,
184+
error.data.sdkVersion
185+
),
186+
docsLink: error.data.showMigrationGuide ? getMigrationGuide() : undefined,
187+
},
188+
];
171189
case SourceMapProcessingIssueType.UNKNOWN_ERROR:
172190
default:
173191
return [];
@@ -301,12 +319,14 @@ export function SourceMapDebug({debugFrames, event}: SourcemapDebugProps) {
301319
key={idx}
302320
title={message.title}
303321
docsLink={
304-
<DocsExternalLink
305-
href={message.docsLink}
306-
onClick={() => handleDocsClick(message.type)}
307-
>
308-
{t('Read Guide')}
309-
</DocsExternalLink>
322+
message.docsLink ? (
323+
<DocsExternalLink
324+
href={message.docsLink}
325+
onClick={() => handleDocsClick(message.type)}
326+
>
327+
{t('Read Guide')}
328+
</DocsExternalLink>
329+
) : null
310330
}
311331
onExpandClick={() => handleExpandClick(message.type)}
312332
>

static/app/components/events/interfaces/crashContent/exception/useSourceMapDebug.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ interface NoURLMatchDebugError extends BaseSourceMapDebugError {
5050
type: SourceMapProcessingIssueType.NO_URL_MATCH;
5151
}
5252

53+
interface SDKOutOfDate extends BaseSourceMapDebugError {
54+
data: {sdkName: string; sdkVersion: string; showMigrationGuide: boolean};
55+
type: SourceMapProcessingIssueType.SDK_OUT_OF_DATE;
56+
}
57+
5358
export type SourceMapDebugError =
5459
| UnknownErrorDebugError
5560
| MissingReleaseDebugError
@@ -59,7 +64,8 @@ export type SourceMapDebugError =
5964
| PartialMatchDebugError
6065
| DistMismatchDebugError
6166
| SourcemapNotFoundDebugError
62-
| NoURLMatchDebugError;
67+
| NoURLMatchDebugError
68+
| SDKOutOfDate;
6369

6470
export interface SourceMapDebugResponse {
6571
errors: SourceMapDebugError[];
@@ -75,6 +81,7 @@ export enum SourceMapProcessingIssueType {
7581
PARTIAL_MATCH = 'partial_match',
7682
DIST_MISMATCH = 'dist_mismatch',
7783
SOURCEMAP_NOT_FOUND = 'sourcemap_not_found',
84+
SDK_OUT_OF_DATE = 'sdk_out_of_date',
7885
}
7986

8087
const sourceMapDebugQuery = ({

0 commit comments

Comments
 (0)