BotBuilder-Samples icon indicating copy to clipboard operation
BotBuilder-Samples copied to clipboard

Task Module not working in ios teams bot

Open Rajkumar235216 opened this issue 4 years ago • 12 comments

Github issues for C# /JS / Java/ Python should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.

Sample information

  1. Sample type: samples
  2. Sample language: python
  3. Sample name: 54. teams-task-module

Describe the bug

Task module not working when opened using Action.Submit button in ios teams chatbot(personal scope)

To Reproduce

Steps to reproduce the behavior: Cloned the repo Navigated to folder 54. teams-task-module Did npm install Updated .env file and manifest json with app ids Created a zip and installed the app ms teams personal scope. Sent a message after installation and bot replied with hero card and adaptive card. Tried pressing with one of the buttons in adaptive cards in ios mobile teams app bot and it says: "The bot encountered an error or bug." "To continue to run this bot, please fix the bot source code." I tried printing traceback of error on bot console. Got following traceback error:

Traceback (most recent call last): File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/msrest/serialization.py", line 1418, in _deserialize found_value = key_extractor(attr, attr_desc, data) File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/msrest/serialization.py", line 1162, in rest_key_extractor return working_data.get(key) AttributeError: 'str' object has no attribute 'get'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/botbuilder/core/bot_adapter.py", line 129, in run_pipeline context, callback File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/botbuilder/core/middleware_set.py", line 69, in receive_activity_with_status return await self.receive_activity_internal(context, callback) File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/botbuilder/core/middleware_set.py", line 79, in receive_activity_internal return await callback(context) File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/botbuilder/core/activity_handler.py", line 78, in on_turn invoke_response = await self.on_invoke_activity(turn_context) File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/botbuilder/core/teams/teams_activity_handler.py", line 155, in on_invoke_activity TaskModuleRequest, turn_context.activity.value File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/botbuilder/core/serializer_helper.py", line 28, in deserializer_helper return deserializer(msrest_cls.name, dict_to_deserialize) File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/msrest/serialization.py", line 1358, in call return self._deserialize(target_obj, data) File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/msrest/serialization.py", line 1432, in _deserialize value = self.deserialize_data(raw_value, attr_desc['type']) File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/msrest/serialization.py", line 1601, in deserialize_data return self._deserialize(obj_type, data) File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/msrest/serialization.py", line 1436, in _deserialize raise_with_traceback(DeserializationError, msg, err) File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/msrest/exceptions.py", line 51, in raise_with_traceback raise error.with_traceback(exc_traceback) File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/msrest/serialization.py", line 1418, in _deserialize found_value = key_extractor(attr, attr_desc, data) File "/home/ec2-user/azurebot/lib64/python3.6/dist-packages/msrest/serialization.py", line 1162, in rest_key_extractor return working_data.get(key) msrest.exceptions.DeserializationError: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'

Expected behavior

Task module should work in ios teams chatbot(personal scope) as it is working in windows/Mac desktops/web team app chatbot.

Rajkumar235216 avatar Jun 15 '22 11:06 Rajkumar235216

Hello @Rajkumar235216, I'm investigating this one.

ram-xv avatar Jun 15 '22 16:06 ram-xv

Hi @ramfattah Is there any update on this issue?

Rajkumar235216 avatar Jun 21 '22 06:06 Rajkumar235216

Hi @Rajkumar235216, thanks for following up. We are actively investigating this issue. Will report back once we have an update.

Thanks.

ram-xv avatar Jun 21 '22 06:06 ram-xv

Hi @Rajkumar235216,

In regards to sample 54.teams-task-module, after clicking one of the buttons, specifically the Custom Form and Youtube buttons do not show the HTML page content.

Here are the steps I took:

  1. Clone Python sample 54.teams-task-module
  2. Set up ngrok tunneling solution
  3. Updated the config.py configuration
  4. Updated CustomForm.html
  5. Updated manifest.json
  6. Ran the bot and tested in teams

Python sample 54.teams-task-module video demo:

Notice the HTML page does not show up after clicking the buttons

https://user-images.githubusercontent.com/38049078/175178862-b2525719-7086-48cc-a8c6-92d1a42d7e75.mp4

Same behavior occurs on:

JavaScript sample 54.teams-task-module video demo:

https://user-images.githubusercontent.com/38049078/175185911-c54abfd2-61c2-49fa-99d7-fb9d117bb232.mp4

.NET sample 54.teams-task-module video demo:

https://user-images.githubusercontent.com/38049078/175181998-94e8d17b-1fde-49b6-8bf1-4762afa58fc5.mp4

VS output logs
Microsoft.Bot.Builder.Integration.AspNet.Core.IBotFrameworkHttpAdapter: Information: SendActivitiesAsync for 1 activities.
Microsoft.Bot.Builder.Integration.AspNet.Core.IBotFrameworkHttpAdapter: Information: Sending activity.  ReplyToId: 1655939891471
Exception thrown: 'System.NotSupportedException' in System.ComponentModel.TypeConverter.dll
Exception thrown: 'System.InvalidCastException' in System.Private.CoreLib.dll
'iisexpress.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.26\System.Xml.XmlSerializer.dll'. 
Exception thrown: 'System.NotSupportedException' in System.ComponentModel.TypeConverter.dll
Exception thrown: 'System.InvalidCastException' in System.Private.CoreLib.dll
Exception thrown: 'System.NotSupportedException' in System.ComponentModel.TypeConverter.dll
Exception thrown: 'System.InvalidCastException' in System.Private.CoreLib.dll
'iisexpress.exe' (CoreCLR: clrhost): Loaded 'C:\Users\ramfa\Documents\Bots\BotBuilder-Samples\samples\csharp_dotnetcore\54.teams-task-module\bin\Debug\netcoreapp3.1\Microsoft.IdentityModel.Clients.ActiveDirectory.dll'. 
'iisexpress.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.26\System.Globalization.dll'. 
'iisexpress.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.26\System.Runtime.Serialization.Json.dll'. 
'iisexpress.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.26\System.Private.DataContractSerialization.dll'. 
'iisexpress.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.26\System.IO.dll'. 
'iisexpress.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.26\System.Text.Encoding.dll'. 
System.Net.Http.HttpClient.Default.LogicalHandler: Information: Start processing HTTP request POST https://smba.trafficmanager.net/amer/v3/conversations/a%3A1qF8xSVwAaqSuwkamYWZ0oDo4HpOXgtHTKokCrKAJi9N7x0u3uIn5gGcsPS7efPPf7MJIIcALYjo_Y5B2n2QHTdroAMAuoxRro-3_TnHLr_UQJ8jXggkXccAOLZmvsfcA/activities/1655939891471
System.Net.Http.HttpClient.Default.ClientHandler: Information: Sending HTTP request POST https://smba.trafficmanager.net/amer/v3/conversations/a%3A1qF8xSVwAaqSuwkamYWZ0oDo4HpOXgtHTKokCrKAJi9N7x0u3uIn5gGcsPS7efPPf7MJIIcALYjo_Y5B2n2QHTdroAMAuoxRro-3_TnHLr_UQJ8jXggkXccAOLZmvsfcA/activities/1655939891471
System.Net.Http.HttpClient.Default.ClientHandler: Information: Received HTTP response after 653.9531ms - Accepted
System.Net.Http.HttpClient.Default.LogicalHandler: Information: End processing HTTP request after 667.7697ms - Accepted
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Executed action method Microsoft.BotBuilderSamples.Controllers.BotController.PostAsync (TeamsTaskModule), returned result Microsoft.AspNetCore.Mvc.EmptyResult in 7120.6714ms.
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Executed action Microsoft.BotBuilderSamples.Controllers.BotController.PostAsync (TeamsTaskModule) in 7279.7207ms
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint 'Microsoft.BotBuilderSamples.Controllers.BotController.PostAsync (TeamsTaskModule)'
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 7409.0333ms 200 
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 POST http://localhost/api/messages application/json; charset=utf-8 1225
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executing endpoint 'Microsoft.BotBuilderSamples.Controllers.BotController.PostAsync (TeamsTaskModule)'
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Route matched with {action = "Post", controller = "Bot", page = ""}. Executing controller action with signature System.Threading.Tasks.Task PostAsync() on controller Microsoft.BotBuilderSamples.Controllers.BotController (TeamsTaskModule).
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Executing action method Microsoft.BotBuilderSamples.Controllers.BotController.PostAsync (TeamsTaskModule) - Validation state: Valid
Microsoft.Bot.Builder.Integration.AspNet.Core.IBotFrameworkHttpAdapter: Information: ProcessActivityAsync
Microsoft.Bot.Builder.Integration.AspNet.Core.IBotFrameworkHttpAdapter: Information: SendActivitiesAsync for 1 activities.
Microsoft.Bot.Builder.Integration.AspNet.Core.IBotFrameworkHttpAdapter: Information: Sending activity.  ReplyToId: f:a588aea4-17c2-2bb3-eefa-c90b0ddaaf25
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Executed action method Microsoft.BotBuilderSamples.Controllers.BotController.PostAsync (TeamsTaskModule), returned result Microsoft.AspNetCore.Mvc.EmptyResult in 53.6025ms.
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Executed action Microsoft.BotBuilderSamples.Controllers.BotController.PostAsync (TeamsTaskModule) in 92.6144ms
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint 'Microsoft.BotBuilderSamples.Controllers.BotController.PostAsync (TeamsTaskModule)'
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 114.5219ms 200 application/json

The following log showed up after clicking the "Custom Form" or "You Tube" button: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Route matched with **{action = "Post", controller = "Bot", page = ""}.** Executing controller action with signature System.Threading.Tasks.Task PostAsync() on controller Microsoft.BotBuilderSamples.Controllers.BotController (TeamsTaskModule).

Not sure if the above behavior is related to your ios issue. We are investigating to find the root cause of this error. Thanks for your patience.

ram-xv avatar Jun 23 '22 01:06 ram-xv

Hi @ramfattah Can you try adding domains under manifest.json -> validDomains without prepending with "https://". for example, if we want to add url of microsoft then instead of adding as "https://microsoft.com", we can add "microsoft.com".

Please let me know, if that works here for you.

For me, these steps are working fine in Mac OS, Windows, Web and Android devices. Except for IOS devices where error also different from here as mentioned in "To Reproduce" section in this Reported issue description.

Rajkumar235216 avatar Jun 23 '22 10:06 Rajkumar235216

Thanks @Rajkumar235216 for this helpful hint. I will give it a try and report back.

ram-xv avatar Jun 27 '22 16:06 ram-xv

Hi @Rajkumar235216,

Tried to add the domain in manifest.json without prepending https:// and still, the same behavior occurs of HTML pages not getting rendered.

It appears I'm reproducing open issue #3695. Not sure if it's related to this issue.

Investigating further. I will report back once we have an update. Thank you.

ram-xv avatar Jul 01 '22 00:07 ram-xv

Hi @Rajkumar235216

Update: I'm now unblocked from #3695, the sample is working fine from my machine. The next step would be to test 54.teams-task-module python sample in IOS to see if we can get a repro.

We will report back once we have an update. Thanks for your patience.

ram-xv avatar Jul 06 '22 22:07 ram-xv

Hi @Rajkumar235216,

I'm able to reproduce this issue using python sample 54.teams-task-module.

Here are the steps I took:

  1. Ran sample 54.teams-task-module using ngrok
  2. Created Bot Framework registration resource in Azure
    • Used the https URL given by running ngrok
  3. Installed the bot app in Teams using the following documentation
  4. Interact with the bot in Teams using iPhone
    • Send any activity
    • Tap on Custom Form or Youtube button
  5. see the error terminal

Looks like when using iPhone Teams app, after clicking the Custom Form or Youtube button, the following error is thrown:

 [on_turn_error] unhandled error: Unable to deserialize to object: type, AttributeError: 'str' object has no attribute 'get'
Traceback (most recent call last):
  File "F:\BotBuilder-Samples\samples\python\54.teams-task-module\env\lib\site-packages\msrest\serialization.py", line 1418, in _deserialize
    found_value = key_extractor(attr, attr_desc, data)
  File "F:\BotBuilder-Samples\samples\python\54.teams-task-module\env\lib\site-packages\msrest\serialization.py", line 1162, in rest_key_extractor
    return working_data.get(key)
AttributeError: 'str' object has no attribute 'get'

ram-xv avatar Jul 07 '22 21:07 ram-xv

Hi @ramfattah, Thanks for update. Yes, I am getting same error in iPhone. Please do the needful in resolving this error.

Rajkumar235216 avatar Jul 08 '22 13:07 Rajkumar235216

@Rajkumar235216 - I have copied this over to Microsoft Teams repo. Please use this GitHub issue for tracking.

Wajeed-msft avatar Jul 12 '22 04:07 Wajeed-msft

Closing as this transferred to msteams-docs repo. New issue tracking here https://github.com/MicrosoftDocs/msteams-docs/issues/6435

ram-xv avatar Jul 19 '22 17:07 ram-xv