Search code examples
botframework

Fix RestError Bot Framework


How do I fix this problem. Been lately receiving this causing my bot to be unresponsive.

enter image description here

I use node v8.11.2 and bot framework sdk v4 botbuilder version 4.8.0.

Thank you!

UPDATE: when I add console.error(error) this shows up:

code: undefined,statusCode: 401,request:WebResource {streamResponseBody: false,url:'https://facebook.botframework.com/v3/conversations/2073757266064270-1820074761374022/activities/IaVk3v72Rl1',method: 'POST',headers: HttpHeaders { _headersMap: [Object] },body:'{"type":"typing","serviceUrl":"https://facebook.botframework.com/","channelId":"facebook","from":{"id":"1820074761374022"},"conversation":{"id":"2073757266064270-1820074761374022"},"recipient":{"id":"2073757266064270"},"replyToId":"IaVk3v72Rl1"}',query: undefined,formData: undefined,withCredentials: false,abortSignal: undefined,timeout: 0,onUploadProgress: undefined,onDownloadProgress: undefined,operationSpec:{ httpMethod: 'POST',path: 'v3/conversations/{conversationId}/activities/{activityId}',urlParameters: [Array],requestBody: [Object],responses: [Object],serializer: [Serializer] } },response:{ body: '',headers: HttpHeaders { _headersMap: [Object] },status: 401 },body: undefined }

ERROR in my other bot:

[onTurnError] unhandled error: Error (node:11104) UnhandledPromiseRejectionWarning: Error: BotFrameworkAdapter.processActivity(): 500 ERRORErrorat new RestError (D:\home\site\wwwroot\node_modules@azure\ms-rest-js\dist\msRest.node.js:1397:28)at D:\home\site\wwwroot\node_modules@azure\ms-rest-js\dist\msRest.node.js:1849:37at process._tickCallback (internal/process/next_tick.js:68:7)at BotFrameworkAdapter. (D:\home\site\wwwroot\node_modules\botbuilder\lib\botFrameworkAdapter.js:638:27) at Generator.throw ()at rejected (D:\home\site\wwwroot\node_modules\botbuilder\lib\botFrameworkAdapter.js:13:65)at process._tickCallback (internal/process/next_tick.js:68:7)(node:11104) 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(). (rejection id: 15)


Solution

  • This can happen if your Facebook token expires. Unfortunately, we don't have a way to refresh it, ourselves. To fix it, delete the Facebook channel, then re-add it following these instructions.