Botbuilder-js: Cannot use different Cosmos DB containers

Created on 2 Apr 2020  路  3Comments  路  Source: microsoft/botbuilder-js

Versions

What package version of the SDK are you using. 4.8.0
What nodejs version are you using: 10.18.1
What browser version are you using
What os are you using: Windows

Describe the bug

Give a clear and concise description of what the bug is.
Cannot use different Cosmos DB containers because of global _doOnce in cosmosDbPartitionedStorage.ts.

To Reproduce

Steps to reproduce the behavior:

const storage = new CosmosDbPartitionedStorage({
                cosmosDbEndpoint: process.env.DB_SERVICE_ENDPOINT,
                authKey: process.env.DB_AUTH_KEY,
                databaseId: process.env.DATABASE_ID,
                containerId: process.env.CONTAINER,
            })
const otherStorage = new CosmosDbPartitionedStorage({
                cosmosDbEndpoint: process.env.DB_SERVICE_ENDPOINT,
                authKey: process.env.DB_AUTH_KEY,
                databaseId: process.env.DATABASE_ID,
                containerId: process.env.OTHER_CONTAINER,
            })
otherStorage.write(...)

Expected behavior

Data gets written to the other container.

Actual behavior

Data gets written to the first container.

[bug]

I might submit a PR to correct and test this.

bug R9

All 3 comments

@mdrichardson, can you chime in on this issue? Thanks!

Doh!, I didn't even consider the use of multiple storages. Thank you for reporting this @juharris

@mdrichardson and I discussed offline. He said he can make this a dictionary of doonce, keyed on databaseid + containerid

Yeah that's one way, or just keep _doOnce as a member variable and it should be fine.

Was this page helpful?
0 / 5 - 0 ratings