Skip to content
Open
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
6 changes: 5 additions & 1 deletion packages/mcp-core/src/api-client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,11 @@ export class SentryApiService {
}

try {
return await response.json();
const text = await response.text();
if (text.trim() === "") {
return null;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Null return breaks caller contracts

Medium Severity

parseJsonResponse now returns null for empty bodies, but every requestJSON caller still treats the result as required response data. Untyped call sites cast and read fields immediately, so empty responses become TypeErrors instead of the previous parse failure. Zod-backed call sites fail later with schema errors. Endpoints that intentionally return no body already go through request, not requestJSON.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d9aff4a. Configure here.

return JSON.parse(text);
} catch (error) {
// JSON parsing failure after successful response
throw new Error(
Expand Down
Loading