element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
GNU Affero General Public License v3.0
11.2k stars 2k forks source link

Cannot invite appservice users which do not (yet) exist #7922

Closed turt2live closed 5 years ago

turt2live commented 5 years ago

Appservices typically follow this sort of flow:

  1. User invites @_example_user:localhost to a room.
  2. Homeserver finds out that @_example_user:localhost doesn't exist, but is in the namespace for an appservice.
  3. Homeserver queries the appservice so it can create the user
  4. Appservice creates the user
  5. Homeserver finishes processing the invite, sending it to the appservice

Recently we added a proof of life check to see if a user exists before proceeding with the invite though (https://github.com/matrix-org/matrix-react-sdk/pull/2317). This fails on Synapse because the user query isn't done, so the request for a profile fails, which means Riot won't try and invite the user, which means the steps above mean nothing because they aren't executed.

TLDR: Synapse needs to hit the appservice's /users endpoint for profile lookups too.

turt2live commented 5 years ago

(reported as the user-facing bug - will open a synapse issue to track the backend issue)

valentinab25 commented 5 years ago

We also have this problem. We are using mxisd as our identity server ( as a synapse password provider integrated with our LDAP ). Since 0.17.8 no new users can be invited in any rooms. We can find the user, but on the SEND INVITES button we receive the error:

Failed to invite the following users to the TEST room: @LDAPUID:OUR_HOMESERVER: User @LDAPUID:OUR_HOMESERVER does not exist

maxidorius commented 5 years ago

This issue is not limited to appservices but to at least the following set of existing tools:

A more detailed explanation of why this needs to be rolled back is available on the PR.

lampholder commented 5 years ago

A spec change is being discussed as to the merits of checking /profile and how we might enhance this API (or add a new one) to handle checking whether a user exists. However, we've decided that for now we can power through client side if we:

turt2live commented 5 years ago

https://github.com/matrix-org/matrix-react-sdk/pull/2434 implements the behaviour @lampholder describes. For those looking to have it always work regardless of account setting, add this to your config.json:

"settingDefaults": {
    "alwaysInviteUnknownUsers": true
}
turt2live commented 5 years ago

Fixed by https://github.com/matrix-org/matrix-react-sdk/pull/2434

lampholder commented 5 years ago

This still seems to be broken for me on develop.

If I:

Also I don't see the option 'Always invite users who may not exist'.

Also I'd like the option to be called 'Prompt before sending invites to potentially invalid matrix IDs' (defaulting to true). If defaulting to true is difficult, then let's go with 'Skip prompt before sending invites to potentially invalid matrix IDs', which is stretching the definition of an affirmative phrased setting.

If default to true is hard, this is something we need to fix :)

githuberyt commented 3 years ago

can't invite users from spaces from another server

if spaces on server A and user joined from server B and tried to invite users to spaces this error pop up " Failed to invite users to the room: "