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.