Back

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

  • 0
  • Teams
  • Web
Zeke(Jafesu)
1 Sep, 2023, 02:04

Trying to user teams.createMembership (appwrite.js), I am trying to send an invite to my gmail but it is failing stating the email is invalid

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

TypeScript
[Error] Method: POST
[Error] URL: /v1/teams/:teamId/memberships
[Error] Type: Utopia\Exception
[Error] Message: Invalid email: Value must be a valid email address
[Error] File: /usr/src/code/vendor/utopia-php/framework/src/App.php
[Error] Line: 742```

My Code:
```.teams.createMembership('client', 'ezekielj221@gmail.com', roles, `${Server.baseURL}/invite/${companyId}?tkn=${authToken}`)```

the email is 100% a valid email, any insight on this?
TL;DR
User is encountering an exception while trying to send an invitation to an email address. The error message states that the email is invalid. The user is using the Appwrite SDK version 1.4.0 and Appwrite version 11.0.0. The team ID provided is not found and results in a 404 error. The solution is to check the order of the parameters in the function call and refer to the function signature in the documentation. The user should also ensure they are using the correct SDK version and Appwrite version.
Drake
1 Sep, 2023, 02:25
  1. what sdk?
  2. what sdk version?
  3. what appwrite version?
Zeke(Jafesu)
1 Sep, 2023, 02:44

appwrite.js "appwrite": "^11.0.0", 1.4.0

Zeke(Jafesu)
1 Sep, 2023, 02:47

okay, order is different than what is in the docs https://appwrite.io/docs/client/teams?sdk=web-default&v=cloud#teamsCreateMembership

TypeScript
Zeke(Jafesu)
1 Sep, 2023, 02:48

that helps, thank you!

Zeke(Jafesu)
1 Sep, 2023, 02:53

@Steven new issue, It is telling me the team id does not exist:

AppwriteException: Team with the requested ID could not be found.

POST https://[REDACTED]/v1/teams/client/memberships 404

Drake
1 Sep, 2023, 03:09

is the user in the team? is the user an owner in the team? Probably not considering that members count is 0 👀

Zeke(Jafesu)
1 Sep, 2023, 03:29

derp. thanks

Zeke(Jafesu)
1 Sep, 2023, 03:52

Okay, I am in the team now, how to i give myself permissions to send invitations?

Drake
1 Sep, 2023, 03:58

The member needs to have role owner

Zeke(Jafesu)
1 Sep, 2023, 04:13

ugh, i set it to "Owner" with a capital O.

as always. thanks for your help Steven

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