compass
compass copied to clipboard
Upserting an Asset returns 500 on duplicate owners
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:
- Upsert an Asset with duplicate owners as shown in the example above
- Get 5xx error
Expected behavior When handling duplicate owners, Compass should handle it by either:
- Distinct the owner list and return no error
- Return 4xx error to indicate that the payload is invalid and let client fix it
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.