-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(source-map-config-issues): Implementing problem, diagnosis and troubleshooting section designs #112393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(source-map-config-issues): Implementing problem, diagnosis and troubleshooting section designs #112393
Changes from 6 commits
5577f65
764d2b3
8b5e24a
b43a101
cacc0da
e989b3b
b8fd217
311092a
e9936d4
0955fab
81dfb8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -74,6 +74,8 @@ export type IssueTypeConfig = { | |||||||||
| * Configuration for the issue-level information header | ||||||||||
| */ | ||||||||||
| header: { | ||||||||||
| // Controls the "X in this issue" event navigation row (First/Latest/Recommended) | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Let's use a docstring here so we get this documentation in the LSP
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Though it looks like some of the other ones are wrong also lol
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated all three in the file ^ |
||||||||||
| eventNavigation: DisabledWithReasonConfig; | ||||||||||
| filterBar: DisabledWithReasonConfig & { | ||||||||||
| // Display the environment filter in an inactive, locked state | ||||||||||
| fixedEnvironment?: boolean; | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,187 @@ | ||
| import type {ReactNode} from 'react'; | ||
|
|
||
| import {LinkButton} from '@sentry/scraps/button'; | ||
| import {InlineCode} from '@sentry/scraps/code'; | ||
| import {Stack} from '@sentry/scraps/layout'; | ||
| import {Text} from '@sentry/scraps/text'; | ||
|
|
||
| import type { | ||
| SourceMapDebugBlueThunderResponse, | ||
| useSourceMapDebugQuery, | ||
| } from 'sentry/components/events/interfaces/crashContent/exception/useSourceMapDebuggerData'; | ||
| import {LoadingError} from 'sentry/components/loadingError'; | ||
| import {LoadingIndicator} from 'sentry/components/loadingIndicator'; | ||
| import {IconOpen} from 'sentry/icons'; | ||
| import {t, tct} from 'sentry/locale'; | ||
|
|
||
| function getDiagnosisMessage(data: SourceMapDebugBlueThunderResponse): ReactNode | null { | ||
| const release = data.release ? ( | ||
| <InlineCode variant="neutral">{data.release}</InlineCode> | ||
| ) : null; | ||
|
|
||
| for (const exception of data.exceptions) { | ||
| for (const frame of exception.frames) { | ||
| const rel = frame.release_process; | ||
| const scraping = frame.scraping_process; | ||
|
|
||
| if (rel) { | ||
| const filePath = <InlineCode>{rel.abs_path}</InlineCode>; | ||
|
|
||
| if (rel.source_file_lookup_result === 'wrong-dist') { | ||
| return ( | ||
| <Text> | ||
| {release | ||
| ? tct( | ||
| 'The source file [filePath] was found but the dist value does not match the uploaded artifact in release [release].', | ||
| {filePath, release} | ||
| ) | ||
| : tct( | ||
| 'The source file [filePath] was found but the dist value does not match the uploaded artifact.', | ||
| {filePath} | ||
| )} | ||
| </Text> | ||
| ); | ||
| } | ||
| if (rel.source_map_lookup_result === 'wrong-dist' && rel.source_map_reference) { | ||
| const mapRef = <InlineCode>{rel.source_map_reference}</InlineCode>; | ||
| return ( | ||
| <Text> | ||
| {release | ||
| ? tct( | ||
| 'The source map [mapRef] was found but the dist value does not match the uploaded artifact in release [release].', | ||
| {mapRef, release} | ||
| ) | ||
| : tct( | ||
| 'The source map [mapRef] was found but the dist value does not match the uploaded artifact.', | ||
| {mapRef} | ||
| )} | ||
| </Text> | ||
| ); | ||
| } | ||
| if ( | ||
| rel.source_file_lookup_result === 'unsuccessful' && | ||
| rel.source_map_reference === null | ||
| ) { | ||
| return ( | ||
| <Text> | ||
| {release | ||
| ? tct( | ||
| 'The source file [filePath] could not be found in any uploaded artifact bundle in release [release]. No source map reference was detected.', | ||
| {filePath, release} | ||
| ) | ||
| : tct( | ||
| 'The source file [filePath] could not be found in any uploaded artifact bundle. No source map reference was detected.', | ||
| {filePath} | ||
| )} | ||
| </Text> | ||
| ); | ||
| } | ||
| if (rel.source_map_lookup_result === 'unsuccessful' && rel.source_map_reference) { | ||
| const mapRef = <InlineCode>{rel.source_map_reference}</InlineCode>; | ||
| return ( | ||
| <Text> | ||
| {release | ||
| ? tct( | ||
| 'The source map referenced by [filePath] points to [mapRef], but no matching artifact was found in release [release].', | ||
| {filePath, mapRef, release} | ||
| ) | ||
| : tct( | ||
| 'The source map referenced by [filePath] points to [mapRef], but no matching artifact was found.', | ||
| {filePath, mapRef} | ||
| )} | ||
| </Text> | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| if (scraping) { | ||
| if (scraping.source_file?.status === 'failure') { | ||
| return ( | ||
| <Text> | ||
| {tct('Sentry could not fetch the source file at [url]: [reason].', { | ||
| url: <InlineCode>{scraping.source_file.url}</InlineCode>, | ||
| reason: scraping.source_file.reason, | ||
| })} | ||
| </Text> | ||
| ); | ||
| } | ||
| if (scraping.source_map?.status === 'failure') { | ||
| return ( | ||
| <Text> | ||
| {tct('Sentry could not fetch the source map at [url]: [reason].', { | ||
| url: <InlineCode>{scraping.source_map.url}</InlineCode>, | ||
| reason: scraping.source_map.reason, | ||
| })} | ||
| </Text> | ||
| ); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (!data.project_has_some_artifact_bundle && !data.release_has_some_artifact) { | ||
| return ( | ||
| <Stack gap="sm"> | ||
| <Text> | ||
| {release | ||
| ? tct( | ||
| 'No source map artifacts have been uploaded for this project in release [release].', | ||
| {release} | ||
| ) | ||
| : t('No source map artifacts have been uploaded for this project.')} | ||
| </Text> | ||
| <LinkButton | ||
| size="sm" | ||
| icon={<IconOpen />} | ||
| external | ||
| href="https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/" | ||
| > | ||
| {t('Upload Instructions')} | ||
| </LinkButton> | ||
| </Stack> | ||
| ); | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
|
|
||
| interface DiagnosisSectionProps { | ||
| sourceMapQuery: ReturnType<typeof useSourceMapDebugQuery>; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. didn't we export the type?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah updated this ^ |
||
| } | ||
|
|
||
| export function DiagnosisSection({sourceMapQuery}: DiagnosisSectionProps) { | ||
| const {data, isPending, isError} = sourceMapQuery; | ||
|
|
||
| function renderContent(): ReactNode { | ||
| if (isPending) { | ||
| return <LoadingIndicator mini />; | ||
| } | ||
|
sentry[bot] marked this conversation as resolved.
|
||
| if (isError) { | ||
| return ( | ||
| <LoadingError | ||
| message={t('Unable to load source map diagnostic information for this event.')} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| const message = getDiagnosisMessage(data); | ||
|
sentry[bot] marked this conversation as resolved.
Outdated
Abdkhan14 marked this conversation as resolved.
Outdated
|
||
| return ( | ||
| message ?? ( | ||
| <Text> | ||
| {t( | ||
| 'Source maps appear to be configured but Sentry could not pinpoint the exact issue.' | ||
| )} | ||
| </Text> | ||
| ) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which would remove the need for this fallback |
||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <Stack gap="md" padding="lg"> | ||
| <Text size="lg" bold> | ||
| {t('Diagnosis')} | ||
| </Text> | ||
| {renderContent()} | ||
| </Stack> | ||
| ); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.