1
votes

Using the cosmos db sdk in a 1.0 function. UpsertDocumentAsync throws error "PartitionKey extracted from document doesn't match the one specified in the header". In my REST Api using the same cosmos db sdk v2.1.3 everything works fine. Only difference in packages is Newtonsoft.Json is version 10.0.2 in function and version 11.0.2 in REST Api. I'm wondering if it has something to do with Netwonsoft and the sdk usage of it may differ between versions. Anyone else having this issue that can shed some light?

1
could you share the code of your function and webapp ? or at least relevant code.Thomas
Please upload the code. I suspect the serialisation of the document being different between the two versions, causing this issue.Nick Chapsas
@NickChapsas, yep it was. Thanks for your reply.Chris Parker

1 Answers

1
votes

It was indeed Json.net. I was upgrading to Azure Function 2.0 and it uses 11.0.2 version. So upgrading my other components to the newest version fixed the issue. Thank you for your quick reply.