botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Bot entry point needs to be named app.js?

Open Orbyt opened this issue 10 years ago • 3 comments

I'm not particularly sure if this is well known or in the docs anywhere..but i've tested this with a couple different bots with the same outcome.

Essentially, if your main entry .js file is named anything other than app.js (like index.js, bot.js, etc..) it will throw a 403 error after being deployed to Azure.

I've tested this several times by deploying a sample bot with a .js file named index.js, testing it (which throws an error), and then renaming the index.js file to app.js and redeploying without changing anything else.

Orbyt avatar Aug 11 '16 06:08 Orbyt

I think you need to configure the entry point in web.config. This might help: https://azure.microsoft.com/en-us/documentation/articles/web-sites-nodejs-chat-app-socketio

Thegaram avatar Aug 11 '16 17:08 Thegaram

In Azure, I have seen it work well with "server.js"

danmarshall avatar Aug 11 '16 18:08 danmarshall

If you are deploying as an Azure Web App, it runs either "app.js" or "server.js". There's some explanation on this azure help page on how they deploy node projects! Alternatively, you can also define your project as an npm package. (just run npm init in the root folder). This lets you define an "npm start" command as well as a "main" directive pointing to your main script. This should allow you to put name your script anything you want, or put it in some subfolder.

Here's an example package.js I use for deploying a bot to azure with a custom startup script:

{
  "name": "mybot-service",
  "version": "1.0.0",
  "description": "package for my bot",
  "main": "some/folder/app.js",
  "dependencies": {
    "botbuilder": "^3.2.3",
    "express": "^4.14.0",
  },
  "devDependencies": {},
  "scripts": {
    "start": "node some/folder/app.js"
  },
  "repository": {
    "type": "git",
    "url": "my_git_url"
  },
  "keywords": [
    "bots",
    "bot",
    "framework"
  ],
  "author": "Joren Lauwers",
  "license": "UNLICENSED"
}

If you have any other questions related to deploying Node apps to azure, the Azure Web Appps documentation should have everything you need!

jorenl avatar Aug 12 '16 19:08 jorenl