mnederlof/com.ubnt.unifi

Beta crashes when starting

Closed this issue · 4 comments

I've just installed the Beta version but it doesn't seem to be starting:

Stack trace: /drivers/wifi-client/driver.js:90 this._debug('Connecting to unifi controller', this.driverSettings['host']); ^ TypeError: Cannot read property 'host' of null at UnifiDriver.initializeConnection (/drivers/wifi-client/driver.js:90:74) at UnifiDriver. (/drivers/wifi-client/driver.js:63:18) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5) Exit code: 1 Exit signal: null

Can't put in settings because the app doesn't start!

Thanks for reporting this, i made a change to fix this.

Thanks @mnederlof,

I just installed the sdk-v2 version, the app is starting but still crashes:

Stack trace: /opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/manager/settings.js:1 (function (exports, require, module, __filename, __dirname) { "use strict";const fs=require("fs"),path=require("path"),Homey=require("homey"),THROTTLE_TIMEOUT=2e3;class ManagerSettings extends Homey.Manager{__onInit(){this._updateSettingsTimeout=void 0,this._writing=!1,Homey.ready(()=>{try{this._settings=require(this._getUserconfPath())}catch(t){this.error(t),this._settings={},this._updateSettingsThrottle()}}),this.__client.on("settings.get",this._onSettingsGet.bind(this)),this.__client.on("settings.set",this._onSettingsSet.bind(this)),this.__client.on("settings.unset",this._onSettingsUnset.bind(this)),this.__ready()}_getUserconfPath(){return path.join(Homey.dir,"userconf.json")}_onSettingsGet(t,e){return!1===t.name?e(null,this._settings):e(null,this.get(t.name))}_onSettingsSet(t,e){try{return this.set(t.name,t.value),e(null,this.get(t.name))}catch(t){return e(t)}}_onSettingsUnset(t,e){try{return this.unset(t.name,t.value),e TypeError: Cannot read property 'com.ubnt.unifi.settings' of undefined at ManagerSettings.get (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/manager/settings.js:1:1138) at ManagerSettings._onSettingsGet (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/manager/settings.js:1:762) at _eventListeners.filter.forEach.t (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/lib/HomeyClient.js:1:1219) at Array.forEach () at HomeyClient._onMessage (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/lib/HomeyClient.js:1:1196) at emitTwo (events.js:126:13) at process.emit (events.js:214:7) at emit (internal/child_process.js:772:12) at _combinedTickCallback (internal/process/next_tick.js:141:11) at process._tickCallback (internal/process/next_tick.js:180:9) Exit code: 1 Exit signal: null

Crash 2:

Stack trace: /api.js:16 driver.unifi.get('/api/self/sites') ^ TypeError: Cannot read property 'get' of null at Object.fn (/api.js:16:26) at ManagerApi._onRest (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/manager/api.js:1:729) at _eventListeners.filter.forEach.t (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/lib/HomeyClient.js:1:1219) at Array.forEach () at HomeyClient._onMessage (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/lib/HomeyClient.js:1:1196) at emitTwo (events.js:126:13) at process.emit (events.js:214:7) at emit (internal/child_process.js:772:12) at _combinedTickCallback (internal/process/next_tick.js:141:11) at process._tickCallback (internal/process/next_tick.js:180:9) Exit code: 1 Exit signal: null

@pdreissen : thanks for checking this out, i now added some more statements to check for settings etc. Can you check if this now fixes the issues you encountered?

@mnederlof now it's just fine ! Thanks!