I have a bot built with Microsoft Bot framework Node.JS SDK, the bot is deployed on a windows server and has been working well for over a year.
Just a few days ago, the Bot stopped responding, checked the bot's log and came across this error.
node:14628) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:14628) UnhandledPromiseRejectionWarning: Error: BotFrameworkAdapter.processActivity(): 400 ERROR
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at IncomingMessage.<anonymous> (C:\inetpub\wwwroot\BotServiceToken\node_modules\botbuilder\lib\botFrameworkAdapter.js:1262:37)
at IncomingMessage.emit (events.js:327:22)
at IncomingMessage.EventEmitter.emit (domain.js:482:12)
at endReadableNT (_stream_readable.js:1221:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
at BotFrameworkAdapter.<anonymous> (C:\inetpub\wwwroot\BotServiceToken\node_modules\botbuilder\lib\botFrameworkAdapter.js:687:27)
at Generator.throw (<anonymous>)
at rejected (C:\inetpub\wwwroot\BotServiceToken\node_modules\botbuilder\lib\botFrameworkAdapter.js:12:65)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14628) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:14628) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Note: The bot works well when I test the Botframework Emulator.
Is there a way to solve this, I have checked the botFrameworkAdapter.js file mentioned in the error but I can't seem to find the bug.