⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@getsantry
Copy link
Contributor

@getsantry getsantry bot commented Jan 15, 2026

No description provided.

@vercel
Copy link

vercel bot commented Jan 15, 2026

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

Project Deployment Review Updated (UTC)
develop-docs Ready Ready Preview, Comment Jan 15, 2026 9:01pm
sentry-docs Ready Ready Preview, Comment Jan 15, 2026 9:01pm

Review with Vercel Agent

@getsantry getsantry bot enabled auto-merge (squash) January 15, 2026 20:50

import {DeRefedOpenAPI} from './open-api/types';

// SENTRY_API_SCHEMA_SHA is used in the sentry-docs GHA workflow in getsentry/sentry-api-schema.
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 doesn't check if the HTTP response is successful before parsing it as JSON, which can cause cryptic build failures.
Severity: HIGH

Suggested Fix

Before calling await response.json(), add a check for the HTTP response status. If !response.ok, throw a new error with a more informative message, including the status and status text, to clarify why the fetch failed. This will prevent cryptic JSON parsing errors and make debugging build failures easier. Example: if (!response.ok) { throw new Error(Failed to fetch OpenAPI schema: ${response.status} ${response.statusText}); }.

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#L9

Potential issue: The `resolveOpenAPI` function fetches an OpenAPI schema from a
`raw.githubusercontent.com` URL. It directly calls `response.json()` without first
verifying `response.ok`. If the requested file is unavailable (e.g., due to an invalid
commit SHA), GitHub will return a 404 response with an HTML body. The `fetch` API does
not treat this as an error, so the code proceeds to call `response.json()` on the HTML,
which throws a cryptic `SyntaxError`. Since this function is called during the build
process (`generateStaticParams`), this error will cause the entire site build to fail,
preventing deployment.

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.

1 participant