Skip to content

fix(control-plane): handle undefined response.data in graph route#239

Merged
nicoloboschi merged 1 commit intovectorize-io:mainfrom
slayoffer:pr/control-plane-error-handling
Jan 30, 2026
Merged

fix(control-plane): handle undefined response.data in graph route#239
nicoloboschi merged 1 commit intovectorize-io:mainfrom
slayoffer:pr/control-plane-error-handling

Conversation

@slayoffer
Copy link
Contributor

Summary

  • Add defensive check for undefined response.data before JSON serialization in graph route

Problem

When the backend graph API returns an error, the SDK sets response.data to undefined. Calling NextResponse.json(undefined) throws Value is not JSON serializable, crashing the control plane.

Solution

Check for error or missing data before serializing, return proper error response with 500 status.

Test plan

  • Verified with backend returning error response
  • Control plane no longer crashes on graph API errors

🤖 Generated with Claude Code

When the backend graph API returns an error, the SDK sets response.data
to undefined. NextResponse.json(undefined) throws "Value is not JSON
serializable". Check for error/missing data before serializing.
Copy link
Collaborator

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

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

we should probably have a way to handle all sdk failures in a single point of the code

@nicoloboschi nicoloboschi merged commit 751f99a into vectorize-io:main Jan 30, 2026
17 of 26 checks passed
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.

2 participants