Skip to content

CSV import of users is failing #23772

@hanoii

Description

@hanoii

Description:

We are importing a very simple sample csv of users, 3 users with just a users.csv file on a zip file, and we are getting an error.

Steps to reproduce:

Just use the https://docs.rocket.chat/guides/administration/admin-panel/import/importcsv as users.csv on zip file and attempp to import it.

Expected behavior:

I expect the users to be imported.

Actual behavior:

Getting an error, see log below.

Server Setup Information:

  • Version of Rocket.Chat Server: 4.1.2
  • Operating System: Linux
  • Deployment Method: Dockerfile FROM registry.rocket.chat/rocketchat/rocket.chat:4.1.2
  • Number of Running Instances: 1
  • NodeJS Version: Dockerfile FROM registry.rocket.chat/rocketchat/rocket.chat:4.1.2
  • MongoDB Version: Dockerfile FROM registry.rocket.chat/rocketchat/rocket.chat:4.1.2

Additional context

From the error I think there's something going on here:

0() { return !Meteor.userId() || !hasPermission(Meteor.userId(), 'edit-other-user-info'); }, // Administrators have permission to change others names, so don't limit those

Relevant logs:

{"level":50,"time":"2021-11-22T22:03:00.827Z","pid":1,"hostname":"rocketchat-5cfbfd4679-w7rmv","name":"CSV Importer","err":{"type":"Error","message":"Meteor.userId can only be invoked in method calls or publications.","stack":"Error: Meteor.userId can only be invoked in method calls or publications.<br>    at AccountsServer.userId (packages/accounts-base/accounts_server.js:117:13)<br>    at Object.Meteor.userId (packages/accounts-base/accounts_common.js:343:32)<br>    at 0 (app/lib/server/functions/setRealName.js:44:23)<br>    at packages/rate-limit/rate-limit.js:49:19<br>    at Array.every (<anonymous>)<br>    at Rule.match (packages/rate-limit/rate-limit.js:44:8)<br>    at packages/rate-limit/rate-limit.js:249:58<br>    at Array.filter (<anonymous>)<br>    at RateLimiter._findAllMatchingRules (packages/rate-limit/rate-limit.js:249:38)<br>    at RateLimiter.increment (packages/rate-limit/rate-limit.js:228:31)<br>    at app/lib/server/lib/RateLimiter.js:18:16<br>    at saveUserIdentity (app/lib/server/functions/saveUserIdentity.js:39:8)<br>    at ImportDataConverter.updateUser (app/importer/server/classes/ImportDataConverter.ts:258:4)<br>    at app/importer/server/classes/ImportDataConverter.ts:331:11<br>    at Array.forEach (<anonymous>)<br>    at ImportDataConverter.convertUsers (app/importer/server/classes/ImportDataConverter.ts:306:9)<br>    at app/importer/server/classes/ImporterBase.js:198:20<br>    at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)<br>    at packages/meteor.js:550:25<br>    at runWithEnvironment (packages/meteor.js:1286:24)"},"msg":"Meteor.userId can only be invoked in method calls or publications."} 
{"level":50,"time":"2021-11-22T22:03:00.828Z","pid":1,"hostname":"rocketchat-5cfbfd4679-w7rmv","name":"CSV Importer","err":{"type":"Error","message":"Meteor.userId can only be invoked in method calls or publications.","stack":"Error: Meteor.userId can only be invoked in method calls or publications.<br>    at AccountsServer.userId (packages/accounts-base/accounts_server.js:117:13)<br>    at Object.Meteor.userId (packages/accounts-base/accounts_common.js:343:32)<br>    at 0 (app/lib/server/functions/setRealName.js:44:23)<br>    at packages/rate-limit/rate-limit.js:49:19<br>    at Array.every (<anonymous>)<br>    at Rule.match (packages/rate-limit/rate-limit.js:44:8)<br>    at packages/rate-limit/rate-limit.js:249:58<br>    at Array.filter (<anonymous>)<br>    at RateLimiter._findAllMatchingRules (packages/rate-limit/rate-limit.js:249:38)<br>    at RateLimiter.increment (packages/rate-limit/rate-limit.js:228:31)<br>    at app/lib/server/lib/RateLimiter.js:18:16<br>    at saveUserIdentity (app/lib/server/functions/saveUserIdentity.js:39:8)<br>    at ImportDataConverter.updateUser (app/importer/server/classes/ImportDataConverter.ts:258:4)<br>    at app/importer/server/classes/ImportDataConverter.ts:331:11<br>    at Array.forEach (<anonymous>)<br>    at ImportDataConverter.convertUsers (app/importer/server/classes/ImportDataConverter.ts:306:9)<br>    at app/importer/server/classes/ImporterBase.js:198:20<br>    at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)<br>    at packages/meteor.js:550:25<br>    at runWithEnvironment (packages/meteor.js:1286:24)"},"msg":"Meteor.userId can only be invoked in method calls or publications."} 
{"level":50,"time":"2021-11-22T22:03:00.838Z","pid":1,"hostname":"rocketchat-5cfbfd4679-w7rmv","name":"CSV Importer","err":{"type":"Error","message":"object [\"\"] is not a valid ObjectId","stack":"Error: object [\"\"] is not a valid ObjectId<br>    at serializeObjectId (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:287:11)<br>    at serializeInto (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:941:17)<br>    at serializeObject (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:347:18)<br>    at serializeInto (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:947:17)<br>    at serializeObject (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:347:18)<br>    at serializeInto (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:729:17)<br>    at serializeObject (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:347:18)<br>    at serializeInto (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:947:17)<br>    at BSON.serialize (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/bson.js:64:28)<br>    at Msg.serializeBson (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/msg.js:127:22)<br>    at Msg.makeDocumentSegment (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/msg.js:119:33)<br>    at Msg.toBin (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/msg.js:105:25)<br>    at MessageStream.writeCommand (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/message_stream.js:55:28)<br>    at Connection.write (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connection.js:373:26)<br>    at _command (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/wireprotocol/command.js:125:10)<br>    at command (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/wireprotocol/command.js:28:5)<br>    at writeCommand (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/wireprotocol/write_command.js:56:3)<br>    at Object.update (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/wireprotocol/index.js:9:5)<br>    at Connection.update (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connection.js:195:8)<br>    at /app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/sdam/server.js:490:13<br>    at Object.callback (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connection_pool.js:345:7)<br>    at processWaitQueue (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connection_pool.js:468:23)"},"msg":"object [\"\"] is not a valid ObjectId"} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions