Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab-08 PartitionKey error #54

Closed
danielkon96 opened this issue Jan 2, 2020 · 5 comments
Closed

Lab-08 PartitionKey error #54

danielkon96 opened this issue Jan 2, 2020 · 5 comments

Comments

@danielkon96
Copy link

Unhandled Exception: Microsoft.Azure.Cosmos.CosmosException: Response status code does not indicate success: 400 Substatus: 1001 Reason: (Microsoft.Azure.Documents.BadRequestException: Message: {"Errors":["PartitionKey extracted from document doesn't match the one specified in the header"]}

No matter what approach I take, no matter how much I research, I still am getting this error. I updated to the latest nuget package for CosmosDB, still getting this error.

I cannot continue the lab without this step.

@danielkon96
Copy link
Author

danielkon96 commented Jan 2, 2020

Ok, so the fix is when you are creating a container in the portal, make sure the partition key is set to /Item.

You will need to create the database and the container manually.

@MathewsThankachan
Copy link

Hi Daniel,

Unfortunately that didnt work for me. Do you have any other solution.

If I dont pass the partionkey to the CreateItemAsync method. It works. But I wanted to make work with passing Partitionkey

Matt

@MathewsThankachan
Copy link

One more thing, I get only the exception reason code as "Response status code does not indicate success: 400 Substatus: 1001 Reason: ()."

@danielkon96
Copy link
Author

Hey Mathews,

Is your reason blank in the error code?

You might need to do /YourPartitionKeyNameHere.

If that doesn't work, do you have a snippet of code?

@MathewsThankachan
Copy link

Thanks Daniel for reaching out. I figured out the weird scenario. my partition key was defined as /PostCode which throws error while the Partition key /Postcode works. Not sure why MS is so particular abt case.

Note : On container it was defined as /Postcode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants