sdk-for-react-native
sdk-for-react-native copied to clipboard
[AppwriteException: Invalid `email` param: Value must be a valid email address]
👟 Reproduction steps
I just simply trying to register user based on email and password. This function is responsible for createUser.
export async function createUser(email, password, userName) {
try {
const newAccount = await account.create(
ID.unique(),
email,
password,
userName
);
// .catch((error) => console.log(error));
console.log(newAccount);
if (!newAccount) throw Error;
const avatarUrl = avatar.getInitials(userName);
await signIn(email, password);
const newUser = await databases.createDocument(
appwriteConfig.databaseId,
appwriteConfig.userCollectionId,
ID.unique(),
{
accountId: newAccount.$id,
email: email,
userName: userName,
avatar: avatarUrl,
}
);
return newUser;
} catch (error) {
console.log(error);
throw new Error(error);
}
}
👍 Expected behavior
It should register user but gives error
👎 Actual Behavior
[AppwriteException: Invalid email param: Value must be a valid email address]
🎲 Appwrite version
Version 0.10.x
💻 Operating system
Linux
🧱 Your Environment
No response
👀 Have you spent some time to check if this issue has been raised before?
- [X] I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- [X] I have read the Code of Conduct
@Suvrajit69, thanks for creating this issue! 🙏🏼 Would you please log email before it's passed into account.create() or share the payload of the request?
I got the same issue for this code as well. Can someone help?
If appwrite aren't interested in building a stable service maybe you all should throw the project into the bin and focus on writing html templates. because why have I been having [AppwriteException: Network request failed] thrown at my face all over development for the past 3 days now?
@stnguyen90 I solved the error. Actually every time when I write my email in my phone, on the keyboard there is auto suggestion apperas showing my email. So I click on it and email form auto filled. But there is a empty space at the end of the email. That is why appwrite says invalid email. I solved the error using .trim(" ") method in my code. But the .trim method should be inside of appwrite code. I can solve this issue if you can help me. Thank you.