[SOLVED] CLI - Register Device

Hello everyone,
I try to do the register device step from : https://github.com/matrix-io/matrix-os
I successfully register my account like indicated in the CLI Page - but - when I do “matrix list devices” I get an error message :

/usr/lib/node_modules/matrix-cli/bin/matrix-list.js:26
Matrix.config.user.id,
^

TypeError: Cannot read property ‘id’ of undefined

I assume it’s link to the other error I get when I : “matrix login” :

Configuration save error: { Error: ENOENT: no such file or directory, open '/usr/lib/node_modules/matrix-cli/lib/…/tmp/store.json’
at Error (native)
errno: -2,
code: ‘ENOENT’,
syscall: ‘open’,
path: ‘/usr/lib/node_modules/matrix-cli/lib/…/tmp/store.json’ }
Login Successful : [my-mail]

Don’t know if it’s correlated but I also wasn’t able to do correctly the CLI Page step : “> matrix login” - even if Im root. When I nano the file created in my home directory it’s empty

Hi, thanks for writing.

We don’t use tmp/store.json anymore, so I suspect you’re on an old version of the CLI. I’ll publish our latest to npm.

Thanks,
Sean

Indeed @CreatorSean Ive done (today) the “npm install matrix-cli -g” and it install “matrix-cli@1.1.8” when your npm page actually indicate 1.1.17

try npm upgrade -f matrix-cli

Ive already done : sudo npm upgrade matrix-cli -g does the -f flag change something ?

update : ok -f or --f = force npm to fetch remote resources

@CreatorSean Im I missing something here. when I try to matrix login (after successfully register) I receive : Invalid user, log in again . So I created a second account (to see if the error remain) …same thing

Matrix 1.1.17 rc

Did you matrix register the user in the rc environment?

Sorry about the -f, it was early and that was a typo. Should have been -g.

What do you mean exactly by “in the rc environment?”

Here is what Ive done :

  • sudo matrix
    then the MATRIX v1.1.17 - rc help print with Setup, Management, Apps, Development info
  • matrix register
    • Registration -- Username: [my-mail]
    • Registration -- Password:[my-pwd]
    • Registration -- Confirm Password: [my-pwd]
      Unable to create user [my-mail], user already exists
      (normal cause Ive already register (with 1.1.17) and Ive received the welcome mail from AD Mobilize)

Then :

  • matrix login
  • Login -- username [my-mail]
  • Login -- password [my-pwd]
    Invalid user, log in again

matrix set env rc it seems like you’re already doing there, i just want
to be sure you’re in the right environment.

1 Like

Thanks @CreatorSean it worked. your command line (with sudo) allowed me to :
Logged Out Successfully Env: rc

then : sudo matrix login
give : Login Successful : [my-mail]

I was able to register my device but I get an error

Device registration request formed... Registering device... New Device [my-device-num] Device registered succesfully Error creating device [my-device-name]: Error: Unable to create task -KSkjKi6dEovalXNXeWB

at /usr/lib/node_modules/matrix-cli/node_modules/matrix-firebase/lib/queue.js:111:32
at /usr/lib/node_modules/matrix-cli/node_modules/firebase/database-node.js:173:539
at Pb (/usr/lib/node_modules/matrix-cli/node_modules/firebase/database-node.js:49:165)
at qc (/usr/lib/node_modules/matrix-cli/node_modules/firebase/database-node.js:32:216)
at rc (/usr/lib/node_modules/matrix-cli/node_modules/firebase/database-node.js:31:835)
at Sh.h.Fb (/usr/lib/node_modules/matrix-cli/node_modules/firebase/database-node.js:212:287)
at Fg.h.ud (/usr/lib/node_modules/matrix-cli/node_modules/firebase/database-node.js:146:251)
at tg.ud (/usr/lib/node_modules/matrix-cli/node_modules/firebase/database-node.js:137:364)
at Zf.fg (/usr/lib/node_modules/matrix-cli/node_modules/firebase/database-node.js:135:280)
at bg (/usr/lib/node_modules/matrix-cli/node_modules/firebase/database-node.js:123:109)

I guess the error is the reason I don’t have any output about MATRIX_DEVICE_ID and MATRIX_DEVICE_SECRET. Is that the reason of the : ok : no in the devices list below ?

sudo matrix list devices
Device ID [my-device-ID] Name [my-device-name] Description [my-description] ok : no Last Online : -

Hey @JaNe, as you can see your device was registered even when the error message popped out, please disregard that error. That message escaped us and we got rid of it on a recent update. Please update using npm update -g matrix-cli.

The reason why the id and secret weren’t shown was because you probably stopped the process when you got that error, before it had actually finished.

Regarding your device, it isn’t displayed as online because you need to set your MATRIX_DEVICE_ID and MATRIX_DEVICE_SECRET environment variables on your rpi and then run MATRIX OS for your device to be displayed as active.

Please register a new device and use the Id and Secret provided

Hi @diego.ribero, Ive done the upgrade but already have the last version of matrix-cli (1.1.17 rc).
I waited +5min nothing happened :-/

Also, how I delete item in device list ? Not indicated in the help list command
sudo matrix list devices remove /or/ delete don’t work

Hey @JaNe, sorry to hear this, it looks like the update isn’t successfully grabbing the latest, v1.1.18, we are going to review and get back to you on this soon.

Regarding the removal of a device, there is no option to do that on the CLI yet, but we’ll work on it and update you on the progress.

@JaNe issue fixed, please update your install and give it a try, you should be using v1.1.20

1 Like

@diego.ribero - cc @dmkmedia “It work” ! sudo npm install -g matrix-cli

For info, maybe you would want to upgrade those packages in future release :

npm WARN deprecated MD5@1.2.2: deprecated, use lowercase 'md5@2.x' from now on npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated to-iso-string@0.0.2: to-iso-string has been deprecated, use @segment/to-iso-string instead. npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade