Botframework-sdk: Node.js deployment on Azure

Created on 24 Oct 2016  路  5Comments  路  Source: microsoft/botframework-sdk

After deploying the bot on Azure, my html code is not found! When i test the bot it says 'Accepted" but when i run the web app via azure, i get this error: {"code":"ResourceNotFound","message":"/ does not exist"}

Most helpful comment

@gcrev93
In order for you to call https://yourbot.azurewebsites.net/ like this, you have to add this piece of code into your server.js or app.js file:
server.get(/.*/, restify.serveStatic({ 'directory': '.', 'default': 'index.html' }));
and create an index.html file in the same folder of your server.js

Let me know if it helps!

All 5 comments

"/" doesn't seem like the correct path - isn't the web service url typically "/api/messages"? In particular, the url in the web browser would be "https://yourbot.azurewebsites.net/api/messages" (though you have to POST to it, not just GET).

@gcrev93, what do you mean by "when I run the web app via azure"? are you visiting the web app with your browser on the root? If that's the case, the error you're seeing is expected.

Most likely you have the following code fragment in your bot, where you tell node what uri it should listen to in server.post(). If you didn't change it from what it is in our samples, that url is '/api/messages'.
server.post('/api/messages', connector.listen());
That's the url you have to enter in the bot endpoint when you register your bot on the Bot Framework Portal. Any other url will give you a 404. And btw, as will says, you need to POST to it, GET will not work.

If you want to interact with the bot, you need to connect it to a channel. Try one of the following:

Hope this helps

@gcrev93, I'm closing this issue, I think our answers should address your problem. Feel free to reopen if you still need help. Thanks a lot!

@gcrev93
In order for you to call https://yourbot.azurewebsites.net/ like this, you have to add this piece of code into your server.js or app.js file:
server.get(/.*/, restify.serveStatic({ 'directory': '.', 'default': 'index.html' }));
and create an index.html file in the same folder of your server.js

Let me know if it helps!

@pdtran3k6 hi, even adding the code server.get , i am still facing the same issues like resource code not found.

Was this page helpful?
0 / 5 - 0 ratings