This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using TranscriptLoggerMiddleware breaks Bot on Azure Infrastructure
The TranscriptLoggerMiddleware works on the Emulator, but fails when run on Azure Infrastructure. This is caused by the invalid modification of the incoming Activity. While outgoing activities are cloned before they are modified, the incoming activity is modified in place. The modifications then create invalid data leading to this JSON fragment for reply activities: { // ... "recipient":{ "properties":{ "role":{} }, "id":"8d51e790-8bd3-4450-af3d-1741838d1354", "role":{} }, // ... } The role key in the properties subobject should not be there and while the second role entry should indeed be set, it should be set to a string, not an object. This results in a http 400 status from the bot framework: { "error": { "code": "BadSyntax", "message": "Invalid or missing Activity in request" } } While adding the role information to the from property of the activity is convenient, it should not modify the incoming activity. To fix this, the incoming activity is cloned before it is modified, as the outgoing activity also lacks the role information, the update of the role attribute is applied to both types. In addition the correct atttribute is updated for the role information.
- Loading branch information
1 parent
2ad8470
commit c417b49
Showing
2 changed files
with
44 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters