Back

[SOLVED] Issue while creating team membership

  • 0
  • Teams
  • Web
  • Accounts
  • Cloud
  • Users
vishwa
11 Jan, 2024, 16:40

export const createMemberShip=async(teamId,role,email,userId)=>{ try{ const promise = await teams.createMembership(teamId,[role],'', email, userId); return(promise)
} catch(err){ console.log(err) return(null) }

}

Causes : AppwriteException: Invalid email param: Value must be a valid email address

TL;DR
Title: [SOLVED] Issue with creating team membership - Developer encountered an issue while creating team membership - Developer passed `''` as the URL parameter, causing an error - Documentation states that the URL parameter is required, but it is not a required property - Developer discovered that passing a valid email address instead of the user ID requires a URL parameter - Solution: Pass a valid email address and provide a URL parameter for redirection
Kenny
11 Jan, 2024, 16:44

well... is the email you're passing through valid?

vishwa
11 Jan, 2024, 16:45

Yes sir

Kenny
11 Jan, 2024, 16:47

Looks like you might be off a bit, it looks to me, from the documentation, that the 3rd item in the createMembership function should be the email. You have ''

vishwa
11 Jan, 2024, 16:49

Oh let me check

Kenny
11 Jan, 2024, 16:53

Here's the type, so you know what should go where.

TypeScript
createMembership(teamId: string, roles: string[], email?: string | undefined, userId?: string | undefined, phone?: string | undefined, url?: string | undefined, name?: string | undefined)
vishwa
11 Jan, 2024, 16:53

AppwriteException: URL is required

vishwa
11 Jan, 2024, 16:54

So ig when the email is passed instead of user id it requires url?

vishwa
11 Jan, 2024, 16:55

It says url is required no matter what i pass.

Kenny
11 Jan, 2024, 16:56

https://appwrite.io/docs/references/cloud/client-web/teams#createMembership

Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist.

So to me this reads as though the URL is required so it knows where to redirect someone. I see it says it's not a required property but it reads as though it is.

vishwa
11 Jan, 2024, 16:57

yeh

vishwa
11 Jan, 2024, 16:57

i gave localhost as the url and it worked

vishwa
11 Jan, 2024, 16:57

thanks a lot sir

Kenny
11 Jan, 2024, 16:57

Sorry for the confusion! Glad you got it working

Kenny
11 Jan, 2024, 16:57

[SOLVED] Issue while creating team membership

vishwa
11 Jan, 2024, 16:58

but here it says N/A

vishwa
11 Jan, 2024, 16:59

@Kenny

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