talk icon indicating copy to clipboard operation
talk copied to clipboard

cli-users delete <userID> throws error

Open realgeek opened this issue 4 years ago • 0 comments
trafficstars

Expected behavior: After running docker exec -it talk_talk_1 sh and in that shell, running bin/cli-users list, I get 3 deprecation warnings followed by the abbreviated list of users. I can search for a given user and copy their ID. Then I run bin/cli-users delete 0025ea1d-4876-41d5-be51-7f43ca077159. The user should be deleted.

Actual behavior: Error message shown. The warnings match the ones produced by the list command.

/usr/src/app $ bin/cli-users delete 0025ea1d-4876-41d5-be51-7f43ca077159
(node:509) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
(node:509) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(node:509) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
TypeError: Cannot read property 'chars' of undefined
    at Cell.mergeTableOptions (/usr/src/app/node_modules/cli-table2/src/cell.js:37:33)
    at /usr/src/app/node_modules/cli-table2/src/table.js:29:12
    at arrayEach (/usr/src/app/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/usr/src/app/node_modules/lodash/lodash.js:9368:14)
    at /usr/src/app/node_modules/cli-table2/src/table.js:28:7
    at arrayEach (/usr/src/app/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/usr/src/app/node_modules/lodash/lodash.js:9368:14)
    at Table.toString (/usr/src/app/node_modules/cli-table2/src/table.js:27:5)
    at printUserAsTable (/usr/src/app/bin/cli-users:112:21)
    at Command.deleteUser (/usr/src/app/bin/cli-users:42:5)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

Related Issues:

Versions: 4.12.0-onbuild, rebuilt locally to include plugins.

The delete command appears to be getting the user data, since calling it with the wrong arg produces an expected error:

bin/cli-users delete [email protected]
(node:519) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
(node:519) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(node:519) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
Error: user with id [email protected] not found
    at Command.deleteUser (/usr/src/app/bin/cli-users:39:13)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

I don't necessarily expect a code fix for this older release, but perhaps providing some guidance on using an external API client to do what we need would be quite helpful.

realgeek avatar Aug 03 '21 21:08 realgeek