Botframework-emulator: Bot Framework-Emulator

Created on 20 Aug 2019  路  24Comments  路  Source: microsoft/BotFramework-Emulator

Hi Team

Am getting this message "Taking longer than usual to connect" when i try to open the bot.

I have tried both URL

http://localhost:3978/api/messages
http://127.0.0.1:3978/api/messages

Please help

Bot Services Bug customer-replied-to customer-reported

All 24 comments

Hi @SenthilPrasad1704 ,

Does your bot code use Microsoft App Credentials (a Microsoft App ID & Microsoft App Password)? If so, make sure you are entering those credentials into the correct input fields when opening a bot via the Emulator.

Also make sure your bot is running on the correct port before trying to connect to it.

Hi Tony
Am not using the Microsoft App Credentials.

How to check that my bot is running on the correct port?
Thanks
Senthil Prasad

Am using the correct port number ,

FYI

server.listen(process.env.port || process.env.PORT || 3978, () => {
    console.log(`\n${ server.name } listening to ${ server.url }`);
    console.log(`\nGet Bot Framework Emulator: https://aka.ms/botframework-emulator`);
    console.log(`\nTo talk to your bot, open the emulator select "Open Bot"`);
});

@SenthilPrasad1704 - How are you running your bot? Are you using Visual Studio Code? Are you running it in debug mode?

I am seeing the same issue today with local bots. I am running the bots in IIS Express via Visual Studio. The bot is definitely running as it accepts posts from Postman, but the emulator seemingly never even posts anything to the messages endpoint.

I have tried connecting with bypass ngrok on and off.
I have reinstalled IIS Express and the emulator. Also tried the nightly for emulator too.

@SenthilPrasad1704
@garypretty

What version of Emulator are you using?

4.5.2-76208

All right, I can reproduce this in the latest version. Looks like this is a genuine bug. I recommend downgrading in the meantime.

@tonyanziano - Is 4.5.2 working for you?

@v-kydela I have been building from source (latest) & using the nightly and I haven't had any issue connecting to local bots.

It's worth noting that I'm only using NodeJS bots, so launching the bots using a terminal or VS Code. So maybe it's an issue with the Emulator interfacing with IIS Express?

@tonyanziano - I have just verified that my Node bot works fine. Try switching to .NET and Visual Studio.

@tonyanziano

I have just realized that the problem was caused by a breakpoint in my code. I didn't realize that I had hit a breakpoint, and now that I've removed it 4.5.2 is working fine. Could that be the problem with all three of us?

@garypretty
@SenthilPrasad1704

Do you have the problem when you try other bots, perhaps with a different SDK?

@v-kydela I've tried launching the dotnet-core echobot sample locally and am able to communicate with it using the Emulator.

Do either of you happen to be behind a corporate proxy? I remember we had a similar issue not too long ago that was caused by the user being behind a proxy.

Comment from other issue for reference:

https://github.com/microsoft/BotFramework-Emulator/issues/1703#issuecomment-520423554

@tonyanziano @v-kydela Apologies for the delayed response - in the UK - I am not behind a corporate proxy and I have now tested this using metered / un-metered and private / public networks. Same results.

I am going to check another machine at my office today to see if this is a local issue to my machine at home - which I am assuming it probably is.

What I cannot get my hear around is the fact that the emulator just never seems to hit the bot at all - I have added a breakpoint to the controller. But if I send a post directly to the endpoint using postman it hits it fine. It feels like there is something blocking the emulator from the bot, I just don't know what it is.

Ok, here is my update of a few scenarios I have tried. This is looking like some sort of issues with the emulator being able to communicate with localhost bots - which could easily be some form of local networking issue, but I am not sure where it is to be honest.

  1. If I point the emulator to http://localhost:3978/api/messages it doesn't connect. I just get the 'taking longer to connect' message and nothing ever happens and seemingly nothing hits the bots endpoint. This is the same regardless of if I have ngrok bypassed for local addresses or not.

  2. However, if I spin up my own ngrok endpoint, point to 3978 and then update the target endpoint in the emulator to use the new ngrok endpoint I spun up myself, the emulator connects successfully and I can debug normally.

So - this seems to rule out the bot being the issue.

Any ideas? Ngrok problem? Again that seems unlikely due to the fact I can spin up my own endpoint and everything works fine.

I won't have this machine with me today now, until tomorrow, and at least I have a workaround - so if you do have any ideas let me know and I can test them then.

Thanks for your help on this one. It's stumped me!

FYI - I am using Ngrok 2.2.8 and I have also tried downgrading the emulator to 4.4.2. Interestingly, on 4.4.2 when using the restart conversation button, I do occasionally see a flash of 'unable to connect' in red at the bottom of the emulator, but I think this is just due to me resetting the conversation and probably a red herring.

@garypretty - Are you saying the Emulator works correctly when you downgrade to 4.4.2?

@garypretty Your second scenario leads me to agree with you that there might be something wrong with how the Emulator is resolving localhost addresses on your machine. Or like you said, it could possibly be some networking configuration problem, however, the fact that it works for you on previous versions makes me doubt that.

Assuming you're on Windows, have you checked your hosts file (C:\Windows\System32\drivers\etc\hosts) for an entry that might be preventing localhost from resolving correctly?

Also, the flash of "Unable to connect" is normal.

@tonyanziano sorry if I wasn't clear. The older version of the emulator wasn't working either. Which makes me think I have some sort of config issue locally.

Apologies for not coming back sooner. Not been able to look further into this for a couple of days. I am planning to try and repro with a vanilla sample later today and will let you know what happens.

@tonyanziano @v-kydela FYI. This looks to be a (very odd) local issue to me. I still haven't tracked down the issue, but I have successfully managed to get things working on another machine. I'll let you know if I find the problem. Thanks for your help so far!

Sounds good @garypretty . I would love to know what it is if you do figure it out.

Hi @garypretty, do you have any updates? Since you have a working solution, maybe we can close this issue?

@garypretty any updates?

Sadly the only solution I found was to blow away my machine and rebuild. This did solve it though so I'm assuming it was a local environment issue.

@garypretty thanks for the update, even if inconclusive. I'd like to close this for now, but please re-open if someone comes in with a reproduction steps that we can use to find a RCA.

Was this page helpful?
0 / 5 - 0 ratings