Debugging a bot

It is inevitable that eventually you will encounter a bug in your bot that is difficult to squash. The worst are bugs that don't cause your program to crash and thus don't provide a useful stack trace and line number for where the crash happened. For most issues, the console.log() method will be enough to help you track down the bug, for the more tenacious bugs however we will need a true debugging environment. This section will introduce you to iron-node (https://s-a.github.io/iron-node/), a cross-platform JavaScript debugging environment based on Chrome's dev tools.

Start by installing iron-node:

npm install -g iron-node

Note again the use of the -g flag, which installs the application globally.

Before we can start debugging, ...

Get Building Slack Bots now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.