"FIREBASE WARNING: Exception was thrown..." when using matrix start

I’ve followed the instructions here https://www.youtube.com/watch?v=ckDD6HEjfAY to get a Pi 3 installed with Matrix OS (on Raspbian), and Matrix CLI on a Windows 10 PC.

I’ve registered a Matrix board and my MATRIX_DEVICE_… variables are set correctly.

I then followed the Simple IoT Application Workflow video at https://www.youtube.com/watch?v=JIGk7rKJv9g

However, when I run matrix start on the PC I get an exception.

On the Pi (name obfuscated as #####) I see:

pi@#####:~/matrix-os$ NODE_ENV=rc node index.js
Environment Selected: rc
Loading...  device
Loading...  event
Loading...  service
bleno warning: adapter state unauthorized, please run as root or with sudo
               or see README for information on running without root/sudo:
               https://github.com/sandeepmistry/bleno#running-on-linux
Not using device data from db, using MATRIX_DEVICE_ID and MATRIX_DEVICE_SECRET instead!
Starting as device: d6a79737465e
hb: sen> [] svc> []
Installed Apps: ledDemo
Local Apps: ledDemo.matrix
Local / Installed ? 0
MXSS Connected: http://mxss.admobilize.com
MALOS COMPONENTS  ? IMU:20013 | Provides yaw/pitch/roll. Check Imu message (protocol buffer)
 ? Humidity:20017 | Provides humidity and temperature. Check Humidity message (protocol buffer)
 ? Everloop:20021 | Write-only. There are 35 leds. Values range from 0 to 255. Check message EverloopImage (protocol buffer)
 ? Pressure:20025 | Provides barometer/altimeter and temperature. Check Pressure message (protocol buffer)
 ? UV:20029 | Provides UV index. Check UV index message (protocol buffer). Also provides a string with the UV risk according to the OMS. See: https://www.epa.gov/sunsafety/uv-index-scale-0
 ? MicArray_Alsa:20037 | Simple ALSA Driver for MATRIX Creator's Microphone Array
 ? Lirc:20041 | Write-read. Get list remotes and send commands via IR. In development
 ? Servo:20045 | Write-read. Servo handler. In development
 ? Gpio:20049 | Write-read. Gpio handler. In development

=<[^\/^]>= [d6a79737465e] ready
[598470bf67262a01009c7e96]
 _  _ ____ ___ ____ _ _  _
 |\/| |__|  |  |__/ |  \/   [o__o]
 |  | |  |  |  |  \ | _/\_  v0.14.3
MATRIX OS can be upgraded. 0.15.0 available! 0.14.3
hb: sen> [] svc> []
installing a19b4f23df73
Stopping ledDemo
Install App: ledDemo 1.0.0
npm WARN ledDemo@1.0.0 No repository field.
ledDemo 1.0.0 installed from https://storage.googleapis.com/admobilize-matrix-apps/apps/ledDemo/598470bf67262a01009c7e96/leddemo-69728113.zip

On the PC (username obfuscated as ******) I see:

C:\Users\******\Documents\Matrix\matrix-demo-app\ledDemo>matrix deploy
 ⣷ Reading  C:\Users\******\Documents\Matrix\matrix-demo-app\ledDemo/
                                                                                                                   Validating configuration file...
Successfully validated configuration file
 Requesting deploy...
 Processing deployment parameters...
 Deploying to device...
 Installing ledDemo on device...
 Application ledDemo was successfully installed!
Application installation SUCCESS

C:\Users\******\Documents\Matrix\matrix-demo-app\ledDemo>matrix start
Starting:  undefined d6a79737465e
FIREBASE WARNING: Exception was thrown by user callback. Error: Query.equalTo failed: First argument contains undefined in property 'users.598470bf67262a01009c7e96.devices.d6a79737465e.apps'
    at Error (native)
    at Md (C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\firebase\database-node.js:100:67)
    at Ld (C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\firebase\database-node.js:99:694)
    at X.h.Jf (C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\firebase\database-node.js:238:60)
    at Object.getIDForName (C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\matrix-firebase\lib\app.js:246:6)
    at C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\bin\matrix-start.js:19:25
    at C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\bin\matrix-init.js:126:16
    at C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\matrix-firebase\lib\util.js:66:9
    at C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\matrix-firebase\node_modules\async\dist\async.js:421:16
    at iterateeCallback (C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\matrix-firebase\node_modules\async\dist\async.js:928:24)
C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\firebase\database-node.js:57
(d="0"+d),c+=d;return c.toLowerCase()}var bc=/^-?\d{1,10}$/;function Wb(a){return bc.test(a)&&(a=Number(a),-2147483648<=a&&2147483647>=a)?a:null}function cc(a){try{a()}catch(b){setTimeout(function(){J("Exception was thrown by user callback.",b.stack||"");throw b;},Math.floor(0))}}function dc(a,b,c){Object.defineProperty(a,b,{get:c})}function ec(a,b){var c=setTimeout(a,b);"object"===typeof c&&c.unref&&c.unref();return c};function fc(a){var b={},c={},d={},e="";try{var f=a.split("."),b=ib(Kb(f[0])||""),c=ib(Kb(f[1])||""),e=f[2],d=c.d||{};delete c.d}catch(g){}return{yg:b,He:c,data:d,og:e}}function gc(a){a=fc(a);var b=a.He;return!!a.og&&!!b&&"object"===typeof b&&b.hasOwnProperty("iat")}function hc(a){a=fc(a).He;return"object"===typeof a&&!0===w(a,"admin")};function ic(){}var jc={};function kc(a){return q(a.compare,a)}ic.prototype.kd=function(a,b){return 0!==this.compare(new C("[MIN_NAME]",a),new C("[MIN_NAME]",

Error: Query.equalTo failed: First argument contains undefined in property 'users.598470bf67262a01009c7e96.devices.d6a79737465e.apps'
    at Error (native)
    at Md (C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\firebase\database-node.js:100:67)
    at Ld (C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\firebase\database-node.js:99:694)
    at X.h.Jf (C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\firebase\database-node.js:238:60)
    at Object.getIDForName (C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\matrix-firebase\lib\app.js:246:6)
    at C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\bin\matrix-start.js:19:25
    at C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\bin\matrix-init.js:126:16
    at C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\matrix-firebase\lib\util.js:66:9
    at C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\matrix-firebase\node_modules\async\dist\async.js:421:16
    at iterateeCallback (C:\Users\******\AppData\Roaming\npm\node_modules\matrix-cli\node_modules\matrix-firebase\node_modules\async\dist\async.js:928:24)

C:\Users\******\Documents\Matrix\matrix-demo-app\ledDemo>

Is it a bleno problem? Is “Starting: undefined d6a79737465e” the issue? That ID is correct for my device.

Any pointers would be greatly appreciated!

this undefined should be the app name, try with matrix start ledDemo. Also, try to update your cli and dependecies too.

I just fired everything back up to try your suggestion, and bizarrely now the Pi won’t start matrix OS. Perhaps a file left over from a previous crash?

pi@#####:~$ cd matrix-os/
pi@#####:~/matrix-os$ NODE_EVS=rc node index.js
Environment Selected: rc
Loading...  device
Loading...  event
Loading...  service
bleno warning: adapter state unauthorized, please run as root or with sudo
               or see README for information on running without root/sudo:
               https://github.com/sandeepmistry/bleno#running-on-linux
Not using device data from db, using MATRIX_DEVICE_ID and MATRIX_DEVICE_SECRET instead!
Starting as device: d6a79737465e
Uncaught exception:  { Error: EACCES: permission denied, open '/home/pi/matrix-os/db/service.db'
    at Error (native)
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/home/pi/matrix-os/db/service.db' } Error: EACCES: permission denied, open '/home/pi/matrix-os/db/service.db'
    at Error (native)
UNKNOWN ERROR! Error: EACCES: permission denied, open '/home/pi/matrix-os/db/service.db'
    at Error (native)
Unable to clean, exitting...

Oh, have you updated the MOS? also i think it should be NODE_ENV=rc

No - my bad. I think I experimented running Matrix OS as root on the last run, so the files in the db directory were owned by root (and thus couldn’t be overwritten). Once removed Matrix OS has started OK.

And… yes - matrix start ledDemo does the job; many thanks!

(Having just rechecked the tutorial video again it does contain the app-name in the matrix start call, so that’s completely my screw up in missing that)

Oh, i’m happy it’s working now