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
Give a clear and concise description of what the bug is.
Cannot use different Cosmos DB containers because of global _doOnce in cosmosDbPartitionedStorage.ts.
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(...)
Data gets written to the other container.
Data gets written to the first container.
[bug]
I might submit a PR to correct and test this.
@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.