Skip to content

Adding Users via Federation stopped working in 3.18.1 #23250

@qwertiko

Description

@qwertiko

Description:

Adding Users via Federation is not working after Updating from 3.17.1 to 3.18.1.
The error message "invalid user" is given.

Steps to reproduce:

  1. Go to Directory
  2. Go to External Users
  3. Search for Federated User
  4. Click on the User to start a room

Expected behavior:

User is added and room created

Actual behavior:

The message "invalid user" is displayed

Server Setup Information:

  • Version of Rocket.Chat Server: 3.18.1
  • Operating System: Ubuntu 20.04
  • Deployment Method: tar
  • Number of Running Instances: 2
  • DB Replicaset Oplog: yes
  • NodeJS Version: v12.22.1
  • MongoDB Version: 4.2.14

Client Setup Information

  • Desktop App or Browser Version: both/Firefox/Chrome
  • Operating System: manjaro/Fedora

Additional context

Debug Log show the following:
Sep 21 12:10:37 laura rocketchat[14765]: server.js:204 Federation ➔ client.error afterCreateDirectRoom => Could not create federated room: TypeError: Cannot read property '0' of undefined
Sep 21 12:10:37 laura rocketchat[14765]: at Object.normalizeUser (app/federation/server/normalizers/user.js:30:16)
Sep 21 12:10:37 laura rocketchat[14765]: at app/federation/server/hooks/afterCreateDirectRoom.js:34:41
Sep 21 12:10:37 laura rocketchat[14765]: at Array.map ()
Sep 21 12:10:37 laura rocketchat[14765]: at app/federation/server/hooks/afterCreateDirectRoom.js:33:51
Sep 21 12:10:37 laura rocketchat[14765]: at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40

Since the error occured in the user.js file trying to get the property emails at the following place:
const resource = _.pick(originalResource, '_id', 'username', 'type', 'emails', 'name', 'federation', 'isRemote', 'createdAt', '_updatedAt');
const email = resource.emails[0].address;

I therefore logged via the console the array "resource" and got the following back:

{ _id: 'LdJc2Ad2iNrqtuw3L', username: 'USERNAME_REDACTED' }

There is clearly no email address that can be accessed in this array. But i am not sure why this is not the case as the user has every attribute set in the database.

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