Open coderjoe opened 1 month ago
We are facing the same issue :(
For some further information - we're doing client login/logout via Teams following this example:
https://github.com/OfficeDev/Microsoft-Teams-Samples using the bot-teams-authentication
example.
If we use MemoryStorage as our IStorage implementation it works as expected with no errors. If we use BlobStorage as our IStorage implementation we get errors after every logout.
We have not tested CosmosDb.
To try and make things a little easier to debug, I've created a reproduction case using the above example. https://github.com/coderjoe/Microsoft-Teams-Samples/tree/repro/blob.storage.logout.errors
Clone the above branch of my fork and you will get a c# project with our reproduction case.
Note that when run with no blob configuration it uses MemoryStorage
and it works fine.
Run again with blob configuration provided and it will use BlobStorage
but exhibit http precondition failed errors.
At this point it is not entirely clear to me if this is actually a bug in the TeamsSSOTokenExchangeMiddleware
or whether the bug actually exists in the implementation of the Microsoft.Bot.Builder.Azure.Blobs
package.
Hopefully this reproduction will assist. Cheers!
Version
4.22.9
Describe the bug
The TeamsSSOTokenExchangeMiddleware fails in DeduplicatedTokenExchangeIdAsync when Microsoft.Bot.Builder.Azure.Blobs is used as the IStorage provider if/when the WriteAsync method returns a concurrency/etag exception.
As a result the system throws Azure.RequestFailedException
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It appears as though the adapter already detects similar errors for MemoryAdapter and the CosmosDb adapter but it is not detecting the error from Azure BlobStorage. I would expect that blob storage would be similarly handled.
Screenshots
No screenshots at this time
Additional context
This seems to already be handled by the middleware for MemoryAdapter and CosmosDB. Does this just need to be extended to look for the Azure BlobStorage version of the exception?
Example failure:
Example Stack Trace: