Back

[SOLVED] Cant invite user to team

  • 0
  • Self Hosted
  • Web
Its_MS
5 May, 2024, 18:10

I am trying to get teams to work, however when I try and invite a user to my team by just supplying a email and name, I get this error?

AppwriteException: Invalid userId param: UID must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, and underscore. Can't start with a leading underscore

TL;DR
Developers couldn't invite users to a team due to passing an undefined value. They realized they could pass "undefined" and solved the issue. The problem arose from an invalid parameter being passed. Solution: Ensure the userID does not start with an underscore and meets character limitations.
Its_MS
5 May, 2024, 18:11

This is the code that I am using.

TypeScript
const result = await teams.createMembership(
      teamId, // teamId
      [roles], // roles
      email, // email (optional)
      "http://localhost:3000", // url
      name // name (optional)
    );
Steven
5 May, 2024, 18:35

Did you look to see what that function expects for the parameters?

Its_MS
5 May, 2024, 18:36

yeah, which is why its even weirder. Here is an image of what it expects.

Steven
5 May, 2024, 18:36

Isn't that different than what you have?

Its_MS
5 May, 2024, 18:37

yeah, but if you read on the left, it says I only need to pass in, user ID or email or phone.

Steven
5 May, 2024, 18:38

Still, order matters for arguments (positional parameters).

Steven
5 May, 2024, 18:39

You're passing a url for the user id

Its_MS
5 May, 2024, 18:39

yeah because I can't pass an empty string, or can I

Steven
5 May, 2024, 18:40

You can pass undefined

Its_MS
5 May, 2024, 18:40

let me give a shot

Its_MS
5 May, 2024, 18:41

yeah perfect, didn't know I could pass undefined. Appreciate that

Its_MS
5 May, 2024, 18:42

[SOLVED] Cant invite user to team

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more