title: Logic App to CosmosDB - PartitionKey extracted from document doesn't match the one specified in the header
body: <p>I am using a CosmosDB connector in my logic app to insert a record into the database. My container name is ordersContainer. Here is my document:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;id&quot;: &quot;98327158-59d3-4b5b-8c36-0b7c6270c18e&quot;,
    &quot;item&quot;: {
      &quot;headers&quot;: {
        &quot;salesNumber&quot;: &quot;LXG995&quot;,
        &quot;dateTime&quot;: &quot;12/23/2020 6:24:40 PM&quot;,
        &quot;locationId&quot;: &quot;DDD444&quot;,
        &quot;locationName&quot;: &quot;Wide World Importers&quot;,
        &quot;locationAddress&quot;: &quot;645 Roosevelt Avenue&quot;,
        &quot;locationPostcode&quot;: &quot;98121&quot;,
        &quot;totalCost&quot;: &quot;424.55&quot;,
        &quot;totalTax&quot;: &quot;42.455&quot;
      },
      &quot;details&quot;: [
        {
          &quot;productId&quot;: &quot;0f5a0fe8-4506-4332-969e-699a693334a8&quot;,
          &quot;quantity&quot;: &quot;20&quot;,
          &quot;unitCost&quot;: &quot;15.99&quot;,
          &quot;totalCost&quot;: &quot;319.8&quot;,
          &quot;totalTax&quot;: &quot;31.98&quot;,
          &quot;productName&quot;: &quot;Beer&quot;,
          &quot;productDescription&quot;: &quot;Hey this isn't ice cream!&quot;
        },
        {
          &quot;productId&quot;: &quot;76065ecd-8a14-426d-a4cd-abbde2acbb10&quot;,
          &quot;quantity&quot;: &quot;10&quot;,
          &quot;unitCost&quot;: &quot;4.49&quot;,
          &quot;totalCost&quot;: &quot;44.9&quot;,
          &quot;totalTax&quot;: &quot;4.49&quot;,
          &quot;productName&quot;: &quot;Gone Bananas&quot;,
          &quot;productDescription&quot;: &quot;I'm not sure how appealing banana ice cream really is.&quot;
        },
        {
          &quot;productId&quot;: &quot;551a9be9-7f1c-447d-83ee-b18f5a6fb018&quot;,
          &quot;quantity&quot;: &quot;15&quot;,
          &quot;unitCost&quot;: &quot;3.99&quot;,
          &quot;totalCost&quot;: &quot;59.85&quot;,
          &quot;totalTax&quot;: &quot;5.985&quot;,
          &quot;productName&quot;: &quot;Matcha Green Tea&quot;,
          &quot;productDescription&quot;: &quot;Green tea ice cream is good for you because it is green.&quot;
        }
      ]
    }
  }
  </code></pre>
  <p>In my container, my partition key is /salesNumber and in my connector, I have the 'salesNumber' (with double-quotes around it. However, I get this error:</p>
  <pre><code>  &quot;code&quot;: &quot;BadRequest&quot;,
    &quot;message&quot;: &quot;Message: {\&quot;Errors\&quot;:[\&quot;PartitionKey extracted from document doesn't match the one specified in the header\&quot;]}\r\nActivityId: ba051769-46cc-4890-b199-c65841f3c0da, Request URI: /apps/a13f0c17-4c1e-488f-a4f7-e0fb0c98bb56/services/4b64d4a5-e7e4-4141-a4a1-5a53ab79bc4b/partitions/1108ee0f-f7e4-4572-b6f8-7c63bea5c122/replicas/132551652008533238p/, RequestStats: \r\nRequestStartTime: 2021-01-17T14:21:22.5778297Z, RequestEndTime: 2021-01-17T14:21:22.5778297Z,  Number of regions attempted:1\r\nResponseTime: 2021-01-17T14:21:22.5778297Z, StoreResult: StorePhysicalAddress: rntbd://cdb-ms-prod-eastus1-fd59.documents.azure.com:14308/apps/a13f0c17-4c1e-488f-a4f7-e0fb0c98bb56/services/4b64d4a5-e7e4-4141-a4a1-5a53ab79bc4b/partitions/1108ee0f-f7e4-4572-b6f8-7c63bea5c122/replicas/132551652008533238p/, LSN: 5, GlobalCommittedLsn: 5, PartitionKeyRangeId: 0, IsValid: True, StatusCode: 400, SubStatusCode: 1001, RequestCharge: 1.24, ItemLSN: -1, SessionToken: 5, UsingLocalLSN: False, TransportException: null, ResourceType: Document, OperationType: Upsert\r\n, SDK: Microsoft.Azure.Documents.Common/2.11.0&quot;
  </code></pre>
  <p>I'm not sure why it is saying that the PartitionKey extracted from the document (which should be the above document) doesn't match the one in the header. Well, isn't the header listed in the document?</p>
  <p>Any help appreciated!</p>
  <p>Thanks!</p>