Skip to content

Bump API schema to {"messag#17065

Open
getsantry[bot] wants to merge 1 commit intomasterfrom
bot/bump-api-schema-to-{"messag

Hidden character warning

The head ref may contain hidden characters: "bot/bump-api-schema-to-{"messag"
Open

Bump API schema to {"messag#17065
getsantry[bot] wants to merge 1 commit intomasterfrom
bot/bump-api-schema-to-{"messag

Conversation

@getsantry
Copy link
Contributor

@getsantry getsantry bot commented Mar 23, 2026

No description provided.

@vercel
Copy link

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
develop-docs Error Error Mar 23, 2026 5:50pm
sentry-docs Error Error Mar 23, 2026 5:50pm

Request Review

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

// 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 = 'b165d78cc294cdc11eb8c9f6b7935c1e9990ff7d';
const SENTRY_API_SCHEMA_SHA = '{"message":"API rate limit exceeded for 52.225.73.162. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}';
Copy link
Contributor

Choose a reason for hiding this comment

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

API rate limit error committed as schema SHA

High Severity

SENTRY_API_SCHEMA_SHA was overwritten with a GitHub API rate limit JSON error response instead of an actual commit SHA. This will break any downstream logic that uses this value to fetch the correct API schema, since it's no longer a valid git SHA.

Fix in Cursor Fix in Web

// 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 = 'b165d78cc294cdc11eb8c9f6b7935c1e9990ff7d';
const SENTRY_API_SCHEMA_SHA = '{"message":"API rate limit exceeded for 52.225.73.162. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}';
Copy link

Choose a reason for hiding this comment

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

Bug: The resolveOpenAPI function does not handle fetch errors when an invalid SENTRY_API_SCHEMA_SHA is provided, leading to unhandled exceptions that can crash the application build and at runtime.
Severity: CRITICAL

Suggested Fix

In resolveOpenAPI, wrap the fetch call and the subsequent response.json() call in a try-catch block. Before parsing the response, add a check for response.ok to ensure the HTTP request was successful. Consider adding a fallback mechanism or logging an error if the schema cannot be fetched.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/build/resolveOpenAPI.ts#L11

Potential issue: The `resolveOpenAPI` function fetches a schema from GitHub using a
commit SHA from the `SENTRY_API_SCHEMA_SHA` variable. If the GitHub API rate limit is
exceeded, this variable can be populated with a JSON error message instead of a valid
SHA. This creates a malformed URL, causing the `fetch` request to fail. The function
lacks error handling, such as a `try-catch` block or a `response.ok` check. As a result,
an unhandled exception is thrown when `response.json()` fails, which will crash both the
Next.js build process and runtime requests for API pages.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants