-
Notifications
You must be signed in to change notification settings - Fork 16
Cannot read property '0' of undefined #12
Comments
Thank you for raising this concern @mrhieu1311. This error is likely to be caused by a delay in response from the Kea CA API. I wasn't able to reproduce this exact situation in my setup, nevertheless, will add a fix in the API function to process such errors. |
Jerin, a possible cause is this in
It's perfectly possible that the body may be split across multiple |
BTW, in related code at the point of the original reported error, this
|
Hi raybellis |
For the |
For the body it's something like:
|
I comment all the line below in /lib/api_service.js and can " npm start" successfull but when i access to web gui : localhost:3000 |
|
Hey @raybellis, just gave you write permission. This project is running on a skeleton crew, so not sure whether we can count on any review procedures. There aren't any defined anyway. Feel free to commit your fix directly. And thanks a lot for the patch! |
I put the patch here rather than committing direct because it's not fully tested. With it in place I can access the Anterius server, but I don't have a Kea server running for it to talk to so I get no useful content out of it. I guess I could fork and send a PR for someone else to test, though :) |
Try adding |
[ { "arguments": { "Dhcp4": { "control-socket": { "socket-name": "/tmp/kea-dhcp4-ctrl.sock", "socket-type": "unix" }, "decline-probation-period": 86400, "dhcp-ddns": { "always-include-fqdn": false, "enable-updates": false, "generated-prefix": "myhost", "max-queue-size": 1024, "ncr-format": "JSON", "ncr-protocol": "UDP", "override-client-update": false, "override-no-update": false, "qualifying-suffix": "", "replace-client-name": "never", "sender-ip": "0.0.0.0", "sender-port": 0, "server-ip": "127.0.0.1", "server-port": 53001 }, "dhcp4o6-port": 0, "echo-client-id": true, "expired-leases-processing": { "flush-reclaimed-timer-wait-time": 25, "hold-reclaimed-time": 3600, "max-reclaim-leases": 100, "max-reclaim-time": 250, "reclaim-timer-wait-time": 10, "unwarned-reclaim-cycles": 5 }, "hooks-libraries": [ { "library": "/usr/local/lib/hooks/libdhcp_lease_cmds.so", "parameters": { } }, { "library": "/usr/local/lib/hooks/libdhcp_ha.so", "parameters": { "high-availability": [ { "heartbeat-delay": 10000, "max-ack-delay": 5000, "max-response-delay": 10000, "max-unacked-clients": 0, "mode": "load-balancing", "peers": [ { "auto-failover": true, "name": "server101", "role": "primary", "url": "http://10.1.32.101:8000/" }, { "auto-failover": true, "name": "server102", "role": "secondary", "url": "http://10.1.32.102:8000/" } ], "send-lease-updates": true, "sync-leases": true, "sync-timeout": 60000, "this-server-name": "server101" } ] } } ], "host-reservation-identifiers": [ "hw-address", "duid", "circuit-id", "client-id" ], "hosts-databases": [ { "host": "127.0.0.1", "name": "isckeadhcp", "password": "ISCkea@123", "port": 3306, "type": "mysql", "user": "isckea" } ], "interfaces-config": { "dhcp-socket-type": "udp", "interfaces": [ "eth0" ], "re-detect": true }, "lease-database": { "lfc-interval": 3600, "type": "memfile" }, "option-data": [ { "always-send": true, "code": 6, "csv-format": true, "data": "10.0.122.2, 103.48.78.156, 8.8.8.8, 103.48.78.157, 8.8.4.4", "name": "domain-name-servers", "space": "dhcp4" } ], "option-def": [ ], "rebind-timer": 1800, "renew-timer": 900, "shared-networks": [ { "match-client-id": true, "name": "test", "option-data": [ ], "relay": { "ip-addresses": [ ] }, "reservation-mode": "all", "subnet4": [ ] } ], "subnet4": [ { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 1225, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.5.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.g.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.5.10-10.122.5.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.5.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.5.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 1226, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.6.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.g.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.6.10-10.122.6.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.6.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.6.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 1227, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.7.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.g.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.7.10-10.122.7.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.7.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "00:14:38:9e:83:84", "ip-address": "10.122.7.254", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:3a:40", "ip-address": "10.122.7.253", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:43:00", "ip-address": "10.122.7.252", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:57:00", "ip-address": "10.122.7.251", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" } ], "server-hostname": "", "subnet": "10.122.7.0/24", "valid-lifetime": 3600 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12210, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.10.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t1.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.10.10-10.122.10.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.10.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.10.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12211, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.11.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t1.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.11.10-10.122.11.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.11.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.11.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12212, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.12.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t1.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.12.10-10.122.12.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.12.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.12.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12213, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.13.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t1.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.13.10-10.122.13.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.13.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "00:14:38:9e:0a:69", "ip-address": "10.122.13.253", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "00:14:38:9f:35:25", "ip-address": "10.122.13.254", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:3b:40", "ip-address": "10.122.13.252", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:46:80", "ip-address": "10.122.13.250", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:58:00", "ip-address": "10.122.13.251", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" } ], "server-hostname": "", "subnet": "10.122.13.0/24", "valid-lifetime": 3600 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12220, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.20.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t2.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.20.10-10.122.20.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.20.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.20.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12221, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.21.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t2.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.21.10-10.122.21.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.21.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.21.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12222, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.22.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t2.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.22.10-10.122.22.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.22.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.22.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12223, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.23.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t2.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.23.10-10.122.23.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.23.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "00:17:08:86:f1:63", "ip-address": "10.122.23.254", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:4d:40", "ip-address": "10.122.23.251", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:54:00", "ip-address": "10.122.23.252", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" } ], "server-hostname": "", "subnet": "10.122.23.0/24", "valid-lifetime": 3600 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12224, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.24.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t2-anm.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.24.150-10.122.24.240" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.24.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.24.0/24", "valid-lifetime": 3600 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12225, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.25.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t2-anm.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.25.10-10.122.25.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.25.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.25.0/24", "valid-lifetime": 3600 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12230, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.30.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t3.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.30.10-10.122.30.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.30.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.30.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12233, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.33.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t3.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.33.10-10.122.33.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.33.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.33.0/24", "valid-lifetime": 3600 } ], "valid-lifetime": 3600 }, "Logging": { "loggers": [ { "debuglevel": 0, "name": "kea-dhcp4", "output_options": [ { "flush": true, "maxsize": 1048576, "maxver": 5, "output": "/usr/local/var/log/kea-dhcp4.log" } ], "severity": "WARN" }, { "debuglevel": 0, "name": "kea-dhcp4.ha_hooks", "output_options": [ { "flush": true, "maxsize": 10240000, "maxver": 1, "output": "/usr/local/var/log/kea-dhcp4.ha_hooks.log" } ], "severity": "WARN" }, { "debuglevel": 99, "name": "kea-dhcp4.bad-packets", "output_options": [ { "flush": true, "maxsize": 10240000, "maxver": 1, "output": "/usr/local/var/log/kea-dhcp4.debug.log" } ], "severity": "DEBUG" } ] } }, "result": 0 } ] |
There's two separate JSON blobs appearing there - please add an extra line e.g. Curiously, I can actually read both those blobs separately, so I wonder if there's a third "empty" blob that's not appearing in the console output that's actually causing the error. |
I have the same issue |
Sadly i have to report that i have the same issue. The KEA Backend is runnig fine, but when i start the NPM i've got the same error. I've added also the latest code changes but the error is still remaining. I am using KEA 1.4.0-p1 (DHCP4 only) with local lease memfile and several subnets. Error 1: TypeError: Cannot read property '0' of undefined |
Does nobody have an idea? |
Hi @TaggerTie , sorry for the delay in response. |
:( :( :( |
@TaggerTie Apologies for the delay, I had committed a patch previously to resolve this issue, unable to reproduce the error. Please allow some time to have this bug rectified. |
Thanks, please let me know if you need further information of my setup |
Does anybody else have a working KEA-Antherius Setup from which i can compare some Settings? |
I am also getting this error and not sure what to do, i can access GUI but its not able to talk to CA |
I have encountered the problem when npm start
root@isc-kea-primary:~/src/kea-anterius#npm start
Anterius Server> Bootup complete
Anterius Server> OUI Database Loaded
Error 1: TypeError: Cannot read property '0' of undefined
at /home/tgdd/src/kea-anterius/app.js:249:135
at
at process._tickCallback (internal/process/next_tick.js:188:7)
This is state of isc kea server
root@isc-kea-primary:~/src/kea-anterius# keactrl status
DHCPv4 server: active
DHCPv6 server: inactive
DHCP DDNS: inactive
Control Agent: active
Kea DHCPv4 configuration file: /usr/local/etc/kea/kea-dhcp4.conf
Kea DHCPv6 configuration file: /usr/local/etc/kea/kea-dhcp6.conf
Kea DHCP DDNS configuration file: /usr/local/etc/kea/kea-dhcp-ddns.conf
Kea Control Agent configuration file: /usr/local/etc/kea/kea-ctrl-agent.conf
keactrl configuration file: /usr/local/etc/kea/keactrl.conf
root@isc-kea-primary:~/src/kea-anterius# netstat -utnpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1076/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1014/sshd
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 8924/kea-ctrl-agent
tcp6 0 0 :::22 :::* LISTEN 1014/sshd
udp 0 0 10.1.32.101:67 0.0.0.0:* 6417/kea-dhcp4
The text was updated successfully, but these errors were encountered: