I ran into this error while building a Logic App in Azure. The solution to this DocumentDB REST API: PartitionKey extracted from document doesn't match is not working.
My logic app receives a POST
request with the raw JSON data, and then sends it to a Cosmos "Create or Update Document" step. In there, I am able to specify my DB, and for my inputs, I have body
and headers
like so:
...
"inputs": {
"body": "@triggerBody()",
"headers": {
"x-ms-documentdb-partitionkey": "@triggerBody()?['date']"
},
...
}
...
My JSON data looks like this:
{
"id": "20190106",
"date": "20190106",
...
}
In the error output, it literally shows my PartitionKey as 20190106
, so the @triggerBody()?['date']
seems to have worked.
Any ideas?