question

Imran-4606 avatar image
0 Votes"
Imran-4606 asked

Azure logic apps CosmosDB Upsert Error 409

Hi,

I'm using Azure logic apps to write a json object into a cosmosDB container (e.g. 1). I sometimes recieve multiple objects with slight variations (e.g 2). I want to keep the latest one so 2 would replace 1 in my container. I've specified the partition and unique key as below. But get the following error when trying to do an upsert. My Aim is to replace any old item with the new one if the /iotID and /Slave are the same. Is my container defined correctly?and if so what causing the conflict?

{
"code": "Conflict",
"message": "Entity with the specified id already exists in the system. ....
}


PartitionKey = /iotID
UniqueKey = /Slave


1) Example input;

{
"iotID": "56586546845",
"Slave": "slave_2",
"id": "95bca874-0087-430d-aa6e-6168e17e19e5",
"receivedDateTime": "2022-02-25T09:15:56+00:00"
}


2)
{
"iotID": "56586546845",
"Slave": "slave_2",
"lat": 53.8954,
"lon": 2.70857,
"id": "e0892d71-0629-4d1f-a3d9-8868db3cce77",
"receivedDateTime": "2022-02-24T15:18:33+00:00"
}

azure-logic-appsazure-cosmos-db
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers