compass icon indicating copy to clipboard operation
compass copied to clipboard

Upserting an Asset returns 500 on duplicate owners

Open StewartJingga opened this issue 4 years ago • 1 comments

Describe the bug When upserting an asset with duplicate owners, Compass returns 5xx with no clear error message.

Sample request payload

{
  "urn": "sample-urn",
  "owners": [
    {
      "uuid": "sample-uuid",
      "email": "[email protected]"
    },
    {
      "uuid": "sample-uuid",
      "email": "[email protected]"
    }
  ]
}

To Reproduce Steps to reproduce the behavior:

  1. Upsert an Asset with duplicate owners as shown in the example above
  2. Get 5xx error

Expected behavior When handling duplicate owners, Compass should handle it by either:

  1. Distinct the owner list and return no error
  2. Return 4xx error to indicate that the payload is invalid and let client fix it

StewartJingga avatar Nov 23 '22 04:11 StewartJingga

Closing — this was fixed in commit 03b14f1 which added owner deduplication by resolved user ID in createOrFetchUsers() before database insertion, preventing the unique constraint violation.

ravisuhag avatar Mar 28 '26 03:03 ravisuhag