Directline API returning 500 internal server error
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)
Please share your bot handle and microsoft app id so we can investigate.
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?
The appid is sufficient. I'll look into this more in the morning (I'm in pacific time zone), and get back to you.
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
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.
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.
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.
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
});
@sharmadine @Gawashi-se0
Are either you still experiencing this issue with the latest bot.builder library? https://www.npmjs.com/package/botbuilder
Not facing the issue now but we still couldn't find the reason of those failures.
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.