Search code examples
node.jsamazon-web-servicesbotkit

Messenger bot using Botkit on AWS: "bodyParser is not defined" error


I set up a Bitnami Node.JS instance on AWS. Installed default Botkit. Updated dependencies. Set up a basic Facebook page/app with Messenger integration. Attempted to run the default Messenger bot example (Facebook_bot.js).

Running the bot gets the following error on load:

ReferenceError: bodyParser is not defined

Since this is all out of the box and using the example Messenger bot, is this an issue with BotKit source? Or have I somehow managed to mess up the minimal setup involved here?


Solution

  • this can mean 1 of 3 things

    • the node.js file usually named index.js does not have var bodyParser = require('body-parser') less likely
    • you do not have body-parser installed from npm to do so in command line run npm i body-parser --save
    • if this is a remote solution and AWS builds based off of package.json add the dependency

    "dependencies": { "body-parser": "^1.17.2" }