microsoft / BotFramework-Emulator

A desktop application that allows users to locally test and debug chat bots built with the Bot Framework SDK.
https://aka.ms/botemulator
MIT License
1.81k stars 752 forks source link

BotFrameworkAdapter.processActivity(): 401 ERROR - Error: Unauthorized Access. Request is not authorized #1417

Closed jefferydai closed 5 years ago

jefferydai commented 5 years ago

Version

The version of the Emulator is 4.3.3

Describe the bug

This is the first time I download the source code of my bot and use the emulator to connect it. When I downloaded source I have pressed "Yes" when asking whether including app settings in the zip file. I just input the my bot URL and press "connect", and then I can see following error in my bot console: BotFrameworkAdapter.processActivity(): 401 ERROR - Error: Unauthorized Access. Request is not authorized(node:17164) UnhandledPromiseRejectionWarning: Error: Error: Unauthorized Access. Request is not authorized at BotFrameworkAdapter.processActivity (E:\KGQA\Azure-MS\djtbot-src\node_modules\botbuilder\lib\botFrameworkAdapter.js:469:19) at process._tickCallback (internal/process/next_tick.js:68:7)(node:17164) 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: 1) (node:17164) [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. BotFrameworkAdapter.processActivity(): 401 ERROR - Error: Unauthorized Access. Request is not authorized (node:17164) UnhandledPromiseRejectionWarning: Error: Error: Unauthorized Access. Request is not authorized at BotFrameworkAdapter.processActivity (E:\KGQA\Azure-MS\djtbot-src\node_modules\botbuilder\lib\botFrameworkAdapter.js:469:19) at process._tickCallback (internal/process/next_tick.js:68:7) (node:17164) 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: 2)

To Reproduce

Steps to reproduce the behavior:

  1. start my local bot (based on node.js): npm start
  2. start the emulator and do following actions: a. press "File"-> "Open Bot" b. Enter a Bot URL of http://localhost:3978/api/messages c. press "Connect" d go to the window where I started my local bot and I can see the above error message. e if I type a message in the emulator, I can not see the response from the bot.

The following is the setting of the emulator: image

Expected behavior

The local bot should not show error message when emulator connects to it.

Screenshots

Below is the console of my local bot image

Additional context

(C:\ProgramData\Anaconda3) C:\Users\Administrator>node --version v10.15.3

Thanks a lot!

jefferydai commented 5 years ago

The README.MD of the bot says only input bot URL : image

I am not sure if this is right. I tried input bot URL, app ID and app password, then after I press "Connect", the bot did not show any error message. BUT when I type my message in the emulator, I still can not see the response. image

image

jefferydai commented 5 years ago

Additionally, I tested my bot in "Test in Web Chat", the bot works well. I can see the response from the bot. image

cwhitten commented 5 years ago

Hello @jefferydai - by chance could you have put the incorrect appId/password in the connection form?

jefferydai commented 5 years ago

Hello Chris,

Thank you very much!

Just when I am replying to you, I notice "If you don't have a bot configuration, create a new bot configuration" in the welcome section of emulator.

[cid:_Foxmail.1@83a3f3fb-7215-a3b2-2f9c-38b9ed9877f3]

Then I create the bot file for my local bot. After I press "Save and connect", this time emulator works well, I can see the response. And I double checked following two types of connecting to by local bot:

  1. Input the URL, appID/password
  2. Select bot which is defined by bot file from "My bots" form in the Welcome section

I find type 1 always fail and type 2 always OK. So I guess if this is a bug.

Thanks a lot.


dai_juntang@pactera.com

From: Chris Whittenmailto:notifications@github.com Date: 2019-04-11 00:10 To: Microsoft/BotFramework-Emulatormailto:BotFramework-Emulator@noreply.github.com CC: jefferydaimailto:dai_juntang@pactera.com; Mentionmailto:mention@noreply.github.com Subject: Re: [Microsoft/BotFramework-Emulator] BotFrameworkAdapter.processActivity(): 401 ERROR - Error: Unauthorized Access. Request is not authorized (#1417)

Hello @jefferydaihttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjefferydai&data=02%7C01%7C%7C4a14e5a6ed4943c227e308d6bdcf0087%7C3c33e9676bae43fb80f883d093bd41ed%7C0%7C0%7C636905094103010363&sdata=g6ZMoAmwVugEO19VqFHN4WOUs2fG0i11YmRzY4S747E%3D&reserved=0 - by chance could you have put the incorrect appId/password in the connection form?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FBotFramework-Emulator%2Fissues%2F1417%23issuecomment-481756393&data=02%7C01%7C%7C4a14e5a6ed4943c227e308d6bdcf0087%7C3c33e9676bae43fb80f883d093bd41ed%7C0%7C0%7C636905094103010363&sdata=Gm0Su8e4M%2FW7kgg3uv0XhhhllZJlP%2B%2FN0Xeqqn7iRSA%3D&reserved=0, or mute the threadhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAqVk4Vs5SnukxveRlw3ZdGIy0NF7WE5vks5vfgzcgaJpZM4cmKy9&data=02%7C01%7C%7C4a14e5a6ed4943c227e308d6bdcf0087%7C3c33e9676bae43fb80f883d093bd41ed%7C0%7C0%7C636905094103020358&sdata=dB%2BWeP0JG9yv%2FS07Jlc1SSMCCX9ecaANUeye%2FGYtZgg%3D&reserved=0.

tonyanziano commented 5 years ago

@jefferydai .

There has been significant work done to the flow for opening a bot via URL over the past 2 months. Please download the latest version of the Emulator over on the nightly repo releases page and if the issue persists, let us know.