botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Directline API returning 500 internal server error

Open sharmadine opened this issue 8 years ago • 11 comments

Bot Info

  • SDK Platform: Node.js
  • SDK Version: 3.14.1
  • Active Channels: Skype, Direct Line (Webchat)
  • Deployment Environment: Azure Bot Service

Issue Description

Getting different errors from directline API endpoint today. The bot is not performing and frequently stops responding to user's request.

Please find below one of the error log entry. We are running the bot in production for a few months now and are observing such errors for the first time. Please help.

Error: POST to 'https://directline.botframework.com/v3/conversations/EPxxxxxxxxxY/activities/EPxxxxxxxxxY%7C0000000' failed: [500]  
    at Request._callback (/usr/src/app/node_modules/bot-services/node_modules/botbuilder/lib/bots/ChatConnector.js:559:46)
    at Request.self.callback (/usr/src/app/node_modules/bot-services/node_modules/request/request.js:188:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:194:7)
    at Request.<anonymous> (/usr/src/app/node_modules/bot-services/node_modules/request/request.js:1171:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:191:7)
    at IncomingMessage.<anonymous> (/usr/src/app/node_modules/bot-services/node_modules/request/request.js:1091:12)
    at Object.onceWrapper (events.js:293:19)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:188:7)
    at endReadableNT (_stream_readable.js:975:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)

sharmadine avatar Apr 26 '18 16:04 sharmadine

Please share your bot handle and microsoft app id so we can investigate.

EricDahlvang avatar Apr 26 '18 18:04 EricDahlvang

Thanks for your response. Please find below the Information:

APP_ID: ad684b78-c94f-4c5e-be5d-8bcb3ccd9c37 Bot_Handle: the handle contains organisation name and won't be able to share on public platform. Is there an email id where I can send it out?

sharmadine avatar Apr 27 '18 04:04 sharmadine

The appid is sufficient. I'll look into this more in the morning (I'm in pacific time zone), and get back to you.

EricDahlvang avatar Apr 27 '18 06:04 EricDahlvang

I'm not seeing anything in our logs that indicate what might be causing the 500 errors. Something you could do to obtain more information about exceptions that occur between the connector and bot is add application insights to the bot configuration : https://docs.microsoft.com/en-us/azure/bot-service/bot-service-manage-analytics

Also, have you implemented a custom state client for the bot, or is it using the default? The default state service has been deprecated: https://blog.botframework.com/2017/12/19/bot-state-service-will-soon-retired-march-31st-2018/

We have some documentation and blog posts about how to use BotBuilder-Azure extensions for state: https://docs.microsoft.com/en-us/azure/bot-service/nodejs/bot-builder-nodejs-state-azure-cosmosdb

EricDahlvang avatar Apr 27 '18 18:04 EricDahlvang

Thanks for the update. We have implemented custom state for quite sometime. We will a relook again. It's bit of surprise that we got 500 errors but you couldn't see it in logs. Not sure how to get to the root cause.

sharmadine avatar Apr 29 '18 07:04 sharmadine

Thanks for the update. We have implemented custom state for quite sometime. We will a relook again. It's bit of surprise that we got 500 errors but you couldn't see it in logs. Not sure how to get to the root cause.

sharmadine avatar Apr 29 '18 07:04 sharmadine

We also encounter similar events and are in trouble. Multiple accounts are running as services, but an event has occurred in all the accounts held.

The following points are found in common. · Events could be confirmed at the same time in 2 days of at least 4/25 (WED) and 4/26 (THU). · Event occurrence time: about 1:30 AM (UTC) · Event resolution time: about 2:00 AM (UTC)

· Although the reason is unknown when the resolution time is reached, 500 errors will not occur · When an event occurs, messages from some bots can not be received correctly.

I am sorry, I want official information that can be considered as possible cause. Thank you.

Gawashi-0 avatar May 01 '18 00:05 Gawashi-0

You can setup application insights to obtain more information: https://docs.microsoft.com/en-us/azure/bot-service/bot-service-manage-analytics

For a .net bot, you could use the method described here, to do more extensive logging of exceptions: https://github.com/Microsoft/BotBuilder/issues/4486#issuecomment-385482293

For a node bot, you can do this:

bot.on('error', function (e) {
    //log exception using your preferred logging tool
}); 

EricDahlvang avatar May 01 '18 22:05 EricDahlvang

@sharmadine @Gawashi-se0

Are either you still experiencing this issue with the latest bot.builder library? https://www.npmjs.com/package/botbuilder

EricDahlvang avatar May 23 '18 22:05 EricDahlvang

Not facing the issue now but we still couldn't find the reason of those failures.

sharmadine avatar May 26 '18 01:05 sharmadine

I apologize, but I also do not know the reason for the failures. Since the issue is no longer occurring, I'm going to close this. Please open a new issue if you experience any further problems.

EricDahlvang avatar May 31 '18 00:05 EricDahlvang