Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
389 views
in Technique[技术] by (71.8m points)

node.js - 404 Not Found with ngrok and Bot Framework

I'm trying to debug a bot locally on Bot Framework Emulator.

I've installed ngrok and I made it start with the emulator itself (using the settings provided by the framefork). The bot starts correctly using npm start, so I've putted the URL on Bot Framework Emulator and I checked the debug mode.

As it starts the emulation stops here and looking at the ngrok traffic inspector I got this.

I've already tried to restart the framework, the bot itself and check if ngrok was already running (I couldn't find any clue about this), so any advice would be useful, thanks in advance!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I used to create a teams conversation bot in c#, and when I test it in local environment, I need to use ngrok to expose my service to the internet so that the bot service I created in azure portal can listen.

I used this command ngrok http -host-header=rewrite 3978, then I can get a 'https' url that is the same as localhost:3978 and set this url+'/api/messages' as 'Messaging endpoint'.

By the way, I need to set appId and app secret in appSetting.json with the value of my azure ad application created when creating 'bot channel registration'. I remembered that if I used error appId, ngrok will get 404 error.

=====================UPDATE=========================

As I really can't understand the error, pls compared your actions with mine and provide more details if needed.

I installed Bot Framework Emulator and test it locally. First I installed it, and I followed the tutorial to make the configuration. I used c# as I metioned above, so when my bot program running locally, it will show me the successful website with a url like 'http://localhost:3978/', so I open a bot in emulator like below, then click 'Connect', pls note here, I never did any other configurations such as set environment variable, all actions are included in the screenshot:

enter image description here

After these steps, I can reach it. By the way, if I didn't enter appid and secret, I will get an error 'Unauthorized', if I used wrong id and secret, an 'incorrect' error will appear. enter image description here

You are using nodejs to compose a bot, so maybe the appId and secret can be found in .env? enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...