Search code examples
node.jsazureslack

How to debug node.js app, slack bot, on Azure?


I have a slack bot written with the botkit module. It's running on Azure. Locally all's good, but on production there's an error that I can't catch.

Have tried the following and other similar ways to debug node.js on Azure but nothing works. https://tomasz.janczuk.org/2013/07/debug-nodejs-applications-in-windows.html

All I get is: Cannot GET /app/server.js/debug

Any ideas?

Update - adding my code:

controller = Botkit.slackbot({
    json_file_store: '../db/',
}).configureSlackApp({
    clientId: process.env.clientId,
    clientSecret: process.env.clientSecret,
    scopes: ['bot']
});

controller.setupWebserver(process.env.PORT, function(err, webserver) {
    webserver.get('/', function(req, res) {
        res.sendFile('index.html', { root: __dirname });
    });

    controller.createWebhookEndpoints(controller.webserver);

    controller.createOauthEndpoints(controller.webserver, function(err, req, res) {
        if (err) {
            res.status(500).send('ERROR: ' + err);
        } else {
            res.sendFile('install.html', { root: __dirname });
        }
    });
});

As Peter noted, I can use VSOnline - pretty cool! However, I guess due to the

  webserver.get('/',

all get queries like /app/server.js/debug are not working.

Cannot GET /app/server.js/debug

Any ideas how to proceed?


Solution

  • Per my experience, I suggest that you can try to remote debugging for NodeJs Application hosted on Azure via two ways below.

    1. Using the Node.js Tools for Visual Studio (NTVS), please see the article Advanced Debugging of the wiki for the project nodejstools on GitHub to know how to debug via VS.

    2. Using the Visual Studio Online service, please see the video Debugging node.js on Channel 9.

    Hope it helps.

    Any concern, please feel free to let me know.