NwangwuOsitadinma/gateman

createRole: Cannot read property 'then' of undefined

Closed this issue · 2 comments

I am trying to create role using gateman.

const mongoose = require("mongoose");
mongoose.connect('mongodb://localhost:27017/authorization', { useNewUrlParser: true });
const gateman = require("gatemanjs").GateMan(mongoose);

gateman.createRole("admin").then((role) => {
  console.log(role);
}).catch((err) => {
  console.log(err);
});

But it is giving me following error:

gateman.createRole("admin").then((role) => {
                           ^

TypeError: Cannot read property 'then' of undefined
    at Object.<anonymous> (C:\Users\saad.mehmood\Desktop\authroization\index.js:4:28)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

I've created a pull request to fix the bug. Update to the latest version of Gateman to fix the bug

Hello @technosoftgit Please upgrade to the latest version of Gatemanjs to fix the bug. Thank you