bluzDK / bluz-gateway

NodeJS gateway for the Bluz to the Particle Cloud
MIT License
6 stars 2 forks source link

Cannot set property 'dkModule' of undefined #14

Open peternoyes opened 8 years ago

peternoyes commented 8 years ago

I am periodically seeing this:

/home/pi/.npm-global/lib/node_modules/bluz-gateway/app.js:106 peripheralList[peripheral.id].dkModule = bluzMod; ^

TypeError: Cannot set property 'dkModule' of undefined at /home/pi/.npm-global/lib/node_modules/bluz-gateway/app.js:106:50 at Peripheral. (/home/pi/.npm-global/lib/node_modules/bluz-gateway/node_modules/noble/lib/peripheral.js:73:7) at Peripheral.g (events.js:260:16) at emitOne (events.js:77:13) at Peripheral.emit (events.js:169:7) at Noble.onServicesDiscover (/home/pi/.npm-global/lib/node_modules/bluz-gateway/node_modules/noble/lib/noble.js:208:16) at emitTwo (events.js:87:13) at emit (events.js:172:7) at NobleBindings.onServicesDiscovered (/home/pi/.npm-global/lib/node_modules/bluz-gateway/node_modules/noble/lib/hci-socket/bindings.js:291:8) at emitTwo (events.js:87:13)


I am running on a Raspberry Pi 3 Only trying to connect with a single bluz for now.

Sometimes this happens as soon as I start the service. Other times it happens after being online for a few minutes. Related to this is that I cannot start the service on boot.

mgmorcos commented 7 years ago

👍

eely22 commented 7 years ago

This seems to be related to the checkForDeadPeripherals call, it may be clearing out values from the array between when the disconnect/reconnect, thereby causing the error. Commenting out this line seems to solve the issue, but I am still investigating if/when old peripherals need to be cleaned out.