Skip to content
This repository has been archived by the owner on Mar 14, 2020. It is now read-only.

Unable to start once supplying Unifi Controller details. #10

Open
LeeRoyy91 opened this issue Jan 3, 2019 · 6 comments
Open

Unable to start once supplying Unifi Controller details. #10

LeeRoyy91 opened this issue Jan 3, 2019 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@LeeRoyy91
Copy link

Unable to start once I have supplied login details in the config / env files

unifi-parental:server Listening on port 4000 +0ms
TypeError: Cannot read property 'block' of undefined
at controllerLogin (/home/ubuntu/unifi-parental/index.js:159:21)
at controller.login (/home/ubuntu/unifi-parental/index.js:68:17)
at /home/ubuntu/unifi-parental/node_modules/node-unifi/unifi.js:1411:13
at /home/ubuntu/unifi-parental/node_modules/async/dist/async.js:958:16
at next (/home/ubuntu/unifi-parental/node_modules/async/dist/async.js:5211:18)
at Request._callback (/home/ubuntu/unifi-parental/node_modules/node-unifi/unifi.js:1394:27)
at Request.self.callback (/home/ubuntu/unifi-parental/node_modules/request/request.js:186:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request. (/home/ubuntu/unifi-parental/node_modules/request/request.js:1163:10)
unifi-parental:server Config saved +403ms
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2019-01-03T11_51_42_894Z-debug.log
ubuntu@ip-172-31-24-98:~/unifi-parental$

Although within the Unifi controller I can see that there has been two login attempts from the server.

Regards,
Lee

@tatlin
Copy link

tatlin commented Jan 12, 2019

@LeeRoyy91 I ran into this as well on both win10 and macOS machines running newest node.js and following the readme instructions from this github. I was able to get around this error by generating an ssh key and adding it to the unifi controller following these instructions. https://help.ubnt.com/hc/en-us/articles/235247068-UniFi-Adding-SSH-Keys-to-UniFi-Devices

@tatlin
Copy link

tatlin commented Jan 12, 2019

hmm, i can ssh into the controller from the mac terminal but unifi-parental still fails to login using the same credentials. Fails at controller.getSelf.controller.login (/Users/mattjezyk/Documents/GitHub/unifi-parental/index.js:68:17)

@tdack
Copy link
Owner

tdack commented Jan 13, 2019

I think the fix is pretty simple. Edit your config.json and change the line that has blocked to read block:

"blocked": [ /* array of mac addresses to be blocked */

 "block": [ /* array of mac addresses to be blocked */ 

I'll fix config-sample.jsonc to reflect what the code expects in the config file.

tdack added a commit that referenced this issue Jan 13, 2019
@tube0013
Copy link

I'm getting the same error with the "block" in my config.json

{
  "controller": {
    "host": "192.168.1.xxx",
    "port": 8443,
    "user": "xxx",
    "password": "xxx",
    "site": "default"
  },
  "server": {
    "key": "server.key",
    "cert": "server.crt",
    "port": 4000
  },
  "data": {
    "Group": {
      "name": "Group Name",
      "timers": [
        {
          "day": 0,
          "action": 1,
          "time": "0700"
        },
        {
          "day": 0,
          "action": 0,
          "time": "2230"
        },
        {
          "day": 1,
          "action": 1,
          "time": "0700"
        },
        {
          "day": 1,
          "action": 0,
          "time": "2230"
        },
        {
          "day": 2,
          "action": 1,
          "time": "0700"
        },
        {
          "day": 2,
          "action": 0,
          "time": "2230"
        },
        {
          "day": 3,
          "action": 1,
          "time": "0700"
        },
        {
          "day": 3,
          "action": 0,
          "time": "2230"
        },
        {
          "day": 4,
          "action": 1,
          "time": "0700"
        },
        {
          "day": 4,
          "action": 0,
          "time": "2400"
        },
        {
          "day": 5,
          "action": 1,
          "time": "0000"
        },
        {
          "day": 5,
          "action": 0,
          "time": "0100"
        },
        {
          "day": 5,
          "action": 1,
          "time": "0700"
        },
        {
          "day": 5,
          "action": 0,
          "time": "2400"
        },
        {
          "day": 6,
          "action": 1,
          "time": "0000"
        },
        {
          "day": 6,
          "action": 0,
          "time": "0100"
        },
        {
          "day": 6,
          "action": 1,
          "time": "0700"
        },
        {
          "day": 6,
          "action": 0,
          "time": "2230"
        }
      ],
      "block": [
        "b8:27:eb:de:91:68",
        "c8:60:00:9a:ba:ca",
        "d8:1d:72:c6:20:96",
        "90:2b:34:05:2f:27",
        "2c:0e:3d:ad:e7:d4",
        "50:1a:c5:a9:91:39",
        "50:1a:c5:a9:91:37"
      ]
    }
  }
}

@tdack
Copy link
Owner

tdack commented Jan 28, 2019

I've found the problem, but it'll take be a couple of days to fix it up (need to brush up on my JS)

In the interim, there is a simple fix - make sure the name: matches the Group Name in the config file, eg;

...
"data": {
    "Group Name": {
      "name": "Group Name",
...

If they don't match then you'll get the error.

@tdack tdack added the bug Something isn't working label Jan 28, 2019
@tdack tdack self-assigned this Jan 28, 2019
@tube0013
Copy link

thanks that got me up and running.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants