0
votes

I've been running into some issues with the twilio and bot framework channel integration.

In a nutshell, a large number of incoming messages and conversations that happen through the twilio channel time out and the user never receives a response. Then, after a few minutes, all the piled up responses will arrive at the same time - almost as iff the responder hangs and then continues. The error occurs only with the twilio channel - the bot it working perfectly when embedded in site, when tested in azure portal, and when connected to slack.

When I first connected twilio to the bot, it was running completely fine for a few days, and now I am getting the following error on roughly 70-80% of the messages which occur through that channel.

On a high level, the error I'm getting specific to the channel is: 'There was an error sending this message to your bot: HTTP status code GatewayTimeout'

Inside of the app logs, the error recording is far more detailed, but still provides no insight into what specifically is causing the error:

HTTP Error 500.1013 - Internal Server Error

The page cannot be displayed because an internal server error has occurred.

Most likely causes: •IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred. •IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly. •IIS was not able to process configuration for the Web site or application. •The authenticated user does not have permission to use this DLL. •The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

Things you can try: •Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account. •Check the event logs to see if any additional information was logged. •Verify the permissions for the DLL. •Install the .NET Extensibility feature if the request is mapped to a managed handler. •Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.

On the twilio side, I get the following error

Error - 11200 HTTP retrieval failure

Possible Causes Web server returned a 4xx or 5xx HTTP response to Twilio Misconfigured Web Server Network disruptions between Twilio and your web server No Content-Type header attached to response Content-Type doesn't match actual content, e.g. an MP3 file that is being served with Content-Type: audio/x-wav, instead of Content-Type: audio/mpeg

Possible Solutions Double check that your TwiML URL does not return a 4xx or 5xx error Make certain that the URL does not perform a 302 redirect to an invalid URL Confirm the URL requested is not protected by HTTP Auth Make sure your web server allows HTTP POST requests to static resources (if the URL refers to .xml or .html files) Verify your web server is up and responsive Check to see that the URL host is not a private or local IP address Verify the ping times and packet loss between your web server and www.twilio.com

Twilio sends a request to Bot Framework, and gets the following info back Msg "Bad Gateway" sourceComponent "14100" ErrorCode "11200" EmailNotification "false" httpResponse "502" LogLevel "ERROR" url "https://sms.botframework.com/api/sms"

Twilio was unable to fetch content from: http://sms.botframework.com/api/sms Error: Total timeout is triggered. Configured tt is 15000ms and we attempted 1 time(s) Account SID: redacted SID: redacted Request ID: redacted Remote Host: sms.botframework.com Request Method: POST Request URI: http://sms.botframework.com/api/sms URL Fragment: true

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Some additional information:

  • Bot is working perfectly when embedded in website, when tested in the azure portal, and when connected to slack.
  • Error seems to occur at the locations in code where await context.sendActivity(messageToReturnToUser) or await dialogContext.beginDialog(this.id) or basically anywhere where we send something back to the user.
  • After a few minutes, bot framework will send all the piled up messages to the end user and they'll get a chunk of sms messages back to back.
  • Error cannot be replicated in any other channel or in the bot framework emulator.
  • Error does not occur with every message. An arbitrary number of messages will go through fine and get responses immediately, but then an arbitrary number of messages will be subject to the delays.
  • I am using paid twilio numbers, no trial errors happening here!

Has anyone else had this problem? Any input or help would be appreciated!

1
You're getting the 11200 Twilio error because of the error on the server, so that's where you should focus your attention. Have you tried any of the remedies in the 500.1013 error message?philnash
Can you please confirm which SDK and version of Botbuilder you are using for your bot?Steven Kanberg
@philnash I've tried all the remedies in the 500.1013 error message, and based on the stack trace, this seems to be an issue with the SDK or bot framework gateway being unable to fire off a response - I was hoping it was something in my code - at least that way I could more easily diagnose the problem :(pojdrov
@StevenKanberg Hi Steven, the version of the botbuilder SDK i'm using is 4.5.3. And it's on node.js!pojdrov
Can you share the code you're using and an example stack trace?philnash

1 Answers

0
votes

This issue has been mitigated on the Azure/BotFramework side. If you are still having issues, please let me know.