forked from microsoft/botbuilder-js
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Versions
botbuilder 4.3.0
botbuilder-azure 4.3.4
nodejs version v10.14.2
Windows 10 pro v1803
Describe the bug
When performing a delete operation in a partitioned cosmosDB collection, the following error is thrown:
“{
“code”:“BadRequest”,
“message”: “PartitionKey value must be supplied for this operation.\r\nActivityId:b46cf62e-d77f-4911-97d4-b8e86186a348,
\r\nRequestStartTime:2019-03 -27 T20:17:05.5558598 Z,
RequestEndTime:2019-03 -27 T20:17:05.5558598 Z,
Number of regions attempted:1 \r\n,
Microsoft.Azure.Documents.Common/2.2.0.0”
}”
To Reproduce
Steps to reproduce the behavior:
-
Install the AzureCosmoDb emulator
-
Create a partitioned collection and insert a new document (Sample image below)
2.1 Use the following information to create a new Cosmos Database in the emulator:
Database name: bot-cosmos-DB
Collection name: bot-collection
PartitionKey: /city
2.2 Add a new document using the following information
{
"id": "001",
"name": "contoso",
"city": "EEUU"
}
-
Use the echobot-with-counter
-
Connect the bot with the CosmosDb created
const policyConfigurator = (policy) => policy.DisableSSLVerification = true;
const getSettings = () => ({
serviceEndpoint: 'https://localhost:8081',
authKey: 'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==',
databaseId: 'bot-cosmos-db',
collectionId: 'bot-collection'
});
- Update the code to attempt to delete the document
5.1 Insert the next code in the onTurn method of the echoBot class
const storage = new CosmosDbStorage(getSettings(), policyConfigurator);
if (turnContext.activity.type === ActivityTypes.Message) {
try {
await storage.delete([turnContext.activity.text]);
} catch (ex) {
await turnContext.sendActivity(`Error message when trying to delete in cosmos DB storage`);
await turnContext.sendActivity(`"${ex.body}"`);
}
} else {
// Generic handler for all other activity types.
await turnContext.sendActivity(`insert the document id to delete`);
}
// Save state changes
await this.conversationState.saveChanges(turnContext);
}
- Run the bot.
- Insert the document id of the document created before. (sample imagen below)
Expected behavior
Delete the document successfully
Screenshots
After, the following result was found.

Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
