azure.core.exceptions.DeserializationError: Cannot deserialize content-type: text/html
Version
4.16.2
Describe the bug
I'm trying to test a python based MS azure bot using a webchat emulator.. i couldn't get the response from the bot.. When i try it locally with the bot emulator, i could a successful connection establishment between bot and emulator and getting an expected responses.. And when both the bot and webchat emulator runs in my local, i'm even 200 response.
Problem is when I deploy the bot, and use this service url and test on the local emulator i'm getting responses like
Error while invoking bot API - Response{protocol=http/1.1, code=500, message=Internal Server Error, url=http://xxxxxxxxxxxx:3972/bot}
at com.mase.webchat.client.AzureClient.postActivity(AzureClient.java:104) ~[classes/:na]
at com.mase.webchat.controller.ChatController.addUser(ChatController.java:86) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_202]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_202]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_202]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_202]
And from the bot end, I could see
File "/usr/local/lib/python3.9/site-packages/botbuilder/core/cloud_adapter_base.py", line 93, in send_activities
response = await connector_client.conversations.reply_to_activity(
File "/usr/local/lib/python3.9/site-packages/botframework/connector/aio/operations_async/_conversations_operations_async.py", line 524, in reply_to_activity
response = await self._client.async_send(
File "/usr/local/lib/python3.9/site-packages/msrest/async_client.py", line 115, in async_send
pipeline_response = await self.config.pipeline.run(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/msrest/pipeline/async_abc.py", line 159, in run
return await first_node.send(pipeline_request, **kwargs) # type: ignore
File "/usr/local/lib/python3.9/site-packages/msrest/pipeline/async_abc.py", line 79, in send
response = await self.next.send(request, **kwargs) # type: ignore
File "/usr/local/lib/python3.9/site-packages/msrest/pipeline/async_requests.py", line 106, in send
return await self.next.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/msrest/pipeline/async_abc.py", line 84, in send
self._policy.on_response(request, response, **kwargs)
File "/usr/local/lib/python3.9/site-packages/msrest/pipeline/universal.py", line 250, in on_response
response.context[self.CONTEXT_NAME] = self.deserialize_from_http_generics(
File "/usr/local/lib/python3.9/site-packages/msrest/pipeline/universal.py", line 226, in deserialize_from_http_generics
return cls.deserialize_from_text(body_bytes, content_type)
File "/usr/local/lib/python3.9/site-packages/msrest/pipeline/universal.py", line 203, in deserialize_from_text
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))
azure.core.exceptions.DeserializationError: Cannot deserialize content-type: text/html
Even cross-verified the content-type in the request payload and it is set as application/json as expected.. and also verified the versions between local and deployed server.
I'm not sure why is this Cannot deserialize content-type: text/html occurs..
Used versions, aiohttp - 3.10.5 azure-core - 1.30.2 botbuilder-core - 4.16.2 botbuilder-integration-aiohttp - 4.16.2 botbuilder-schema - 4.16.2 botframework-streaming - 4.16.2 urllib3 - 1.26.19 yarl - 1.9.4
@Stevenic @pcostantini @mgiovani Can someone help with this.
Hi, can anyone help on this
I'm not familiar with the context of this. It would appear when trying to send a response to the original request. i.e., The bot receives an Activity via an HTTP POST, and likely sends a response to the endpoint indicated in the Activity.ServiceUrl property. In no case would HTML even be expected. Though I don't know in this case where it's sending the response to.
Closing due to inactivity. Please feel free to reopen if the issue persists or you have new details to share.