Skip to content
Closed
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 = '02f06b8f76bb59e961f2c6eeeb6b87ab55f7e870';
const SENTRY_API_SCHEMA_SHA = 'f17a6ed19937d2d852808703456bfd6638bcac33';

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 error handling, which will cause an unhandled rejection and crash the build process if the request fails.
  • Description: In the resolveOpenAPI function, the production path fetches a schema from raw.githubusercontent.com. This fetch call is not wrapped in a try...catch block, nor does it validate the HTTP response status before calling response.json(). If the network request fails or GitHub returns a non-200 status (e.g., the file at the specified SHA does not exist), the await response.json() call will throw an error. Because this function is executed during static site generation, this unhandled promise rejection will crash the entire build process, preventing deployment.

  • Suggested fix: Wrap the fetch call and the subsequent response.json() in a try...catch block. Before parsing the JSON, check if response.ok is true. If the request fails or the response is not okay, log the error and explicitly throw an exception to ensure the build fails with a clear message rather than an unhandled rejection.
    severity: 0.7, confidence: 0.9

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

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

Expand Down
Loading