Back

createMembership with userId and without email

  • 0
  • Teams
  • Functions
  • Web
sokratesli
16 Feb, 2024, 10:26

I execute the following command in the nodejs server sdk:

const createNewMember = await teams.createMembership(teamId, [], '', userId);

roles = empty array email = empty string

I get the following error message: "Invalid email parameter: Value must be a valid email address" However, in the documentation under "TeamsApi/createMembership" it says: "You only need to enter one of the following: User ID, email or phone number. Appwrite will primarily accept the user ID > email > phone number if you specify more than one of these parameters."

Why do I still need the email?

TL;DR
Developers are trying to use the `createMembership` function in the Node.js server SDK without specifying an email address, as mentioned in the documentation. However, they are encountering an error message stating that a valid email address is required. They are confused as to why they still need to provide an email when the documentation suggests otherwise. Solution: It seems the documentation might be incorrect. To resolve this issue, developers will need to provide a valid email address when using the `createMembership` function.
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