Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

(node:27) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'leases' of undefined #14

Open
hijak opened this issue Sep 16, 2018 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@hijak
Copy link

hijak commented Sep 16, 2018

Hi

I have most things working for a docker image..

based on https://github.com/sn00p/docker-kea i have bolted anterius in

https://git.d4.re/jack/docker-dhcpd

im using these config files

anterius_config.json

{
  "server_addr": "localhost",
  "server_port": "8181",
  "stat_refresh_interval": "5",
  "admin_user": "keaadmin",
  "admin_password": "keaadmin",
  "current_server": "dhcp4",
  "current_host_index": 0,
  "server_host_list": [
    {
      "hostname": "srv0.exnet.lan",
      "svr_addr": "localhost",
      "svr_port": "8181"
    }
  ],
  "leases_file": "/etc/kea/kea-leases4.csv",
  "log_file": "/var/log/kea-dhcp4.log",
  "config_file": "/etc/kea/kea-dhcp4.conf",
  "shared_network_critical_threshold": "95",
  "shared_network_warning_threshold": "0",
  "leases_per_minute_threshold": "50",
  "email_alert_to": "",
  "sms_alert_to": "",
  "slack_webhook_url": "",
  "slack_alert_channel": ""
}

kea-dhcp4.conf

{
   "Dhcp4":{
      "interfaces-config":{
         "interfaces":[
            "enp2s0f0"
         ]
      },
      "control-socket":{
         "socket-type":"unix",
         "socket-name":"/tmp/kea-dhcp4-ctrl.sock"
      },
      "lease-database":{
         "type":"memfile",
         "lfc-interval":3600
      },
      "expired-leases-processing":{
         "reclaim-timer-wait-time":10,
         "flush-reclaimed-timer-wait-time":25,
         "hold-reclaimed-time":3600,
         "max-reclaim-leases":100,
         "max-reclaim-time":250,
         "unwarned-reclaim-cycles":5
      },
      "renew-timer":900,
      "rebind-timer":1800,
      "valid-lifetime":3600,
      "option-data":[
         {
            "name":"domain-name-servers",
            "data":"10.13.37.20"
         },
         {
            "code":15,
            "data":"exnet.lan"
         },
         {
            "name":"domain-search",
            "data":"home.exnet.lan, stage.exnet.lan, prod.exnet.lan"
         },
         {
            "name":"default-ip-ttl",
            "data":"0xf0"
         }
      ],
      "hooks-libraries":[

      ],
      "subnet4":[
         {
            "subnet":"10.13.37.0/24",
            "pools":[
               {
                  "pool":"10.13.37.100 - 10.13.37.254"
               }
            ],
            "option-data":[
               {
                  "name":"routers",
                  "data":"10.13.37.1"
               }
            ]
         }
      ]
   },
   "Logging":{
      "loggers":[
         {
            "name":"kea-dhcp4",
            "output_options":[
               {
                  "output":"/var/log/kea-dhcp4.log"
               }
            ],
            "severity":"INFO",
            "debuglevel":0
         }
      ]
   }
}

but i get this warning when trying to view leases

[WS] Incoming Subscription 'dhcp_statistics'
(node:27) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'leases' of undefined
    at /srv/anterius/routes/nw_detail_info.js:191:42
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:27) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:27) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

not sure whats going wrong here?

@Anthrino
Copy link
Contributor

Thanks for pointing this out @hijak.
I presume this error is being caused due to the incorrect usage of Promises in API calls.
Not sure how to reproduce the exact condition but similar errors have been raised at different API call points.
Will fix the common source code and commit asap.

@Anthrino Anthrino added the bug Something isn't working label Sep 21, 2018
@Anthrino Anthrino self-assigned this Sep 21, 2018
@kamcio2603
Copy link

Any progress?

@youyi1314
Copy link

youyi1314 commented Feb 27, 2019

If you facing the problem above.
please check this : https://github.com/isc-projects/kea-anterius#setup-hooks-library-for-leases-commands

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