#7297·nango

PATCH connection end_user clears its existing organization

Author: LevSky22Created Aug 29, 2026Updated Sep 28, 2026
LabelsStale

Describe the bug

PATCH /connections/{connectionId} accepts end_user, but the request schema does not accept the end user's existing organization. Updating an organization-linked end user therefore clears its native organization fields.

This is still present on master at 8de834738.

Reproduction

  1. Create a connection through a Connect session with both end_user and organization.
  2. Confirm GET /connection/{connectionId} returns end_user.organization.
  3. Send:
http
PATCH /connections/{connectionId}?provider_config_key={integrationId}
Content-Type: application/json

{
  "end_user": {
    "id": "user-123",
    "email": "[email protected]",
    "display_name": "Updated name"
  }
}
  1. Read the connection again.

Actual behavior

The end user's organization becomes null.

handlePatchConnection calls EndUserMapper.apiToEndUser(body.end_user) without an organization. The mapper converts that omission to organization: null, and the subsequent end-user update writes null organization fields.

Expected behavior

Updating only end_user identity fields should preserve the existing organization. Alternatively, the PATCH schema should accept an explicit organization update and distinguish omission from clearing.

Additional impact

An end user may be linked to multiple connections. Updating its shared row through one connection can therefore clear the organization for every linked connection.