Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/build/resolveOpenAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {DeRefedOpenAPI} from './open-api/types';

// SENTRY_API_SCHEMA_SHA is used in the sentry-docs GHA workflow in getsentry/sentry-api-schema.
// DO NOT change variable name unless you change it in the sentry-docs GHA workflow in getsentry/sentry-api-schema.
const SENTRY_API_SCHEMA_SHA = '698818c57d5c32e958e88a0ee2bd1a333f6f2a9f';
const SENTRY_API_SCHEMA_SHA = '6ba1c0041dd7a133057e602ed1495d03e938b109';

const activeEnv = process.env.GATSBY_ENV || process.env.NODE_ENV || 'development';

Comment on lines +11 to 14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: The fetch call in resolveOpenAPI lacks HTTP status checking before parsing the JSON response, which can crash the build process on failure.
  • Description: The resolveOpenAPI function fetches a schema from a GitHub URL. It does not check the HTTP response status before attempting to parse the body with response.json(). If the SENTRY_API_SCHEMA_SHA is invalid, GitHub returns a 404 response with an HTML body. Attempting to parse this HTML as JSON throws a SyntaxError. Because this function is executed during static site generation, this unhandled exception will crash the entire build process, preventing deployment. This failure pattern has occurred previously, as seen in a past Sentry issue.

  • Suggested fix: After the fetch call, check the response.ok status. If the response is not successful, throw a descriptive error to fail the build gracefully instead of letting the response.json() call raise an unhandled SyntaxError.
    severity: 0.85, confidence: 0.95

Did we get this right? 👍 / 👎 to inform future reviews.

Expand Down
Loading