Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AppwriteException: Invalid email param: Value must be a valid email address] #15

Closed
2 tasks done
Suvrajit69 opened this issue Apr 28, 2024 · 4 comments
Closed
2 tasks done
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@Suvrajit69
Copy link

Suvrajit69 commented Apr 28, 2024

👟 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?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@Suvrajit69 Suvrajit69 added the bug Something isn't working label Apr 28, 2024
@stnguyen90
Copy link
Contributor

@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?

@stnguyen90 stnguyen90 self-assigned this May 15, 2024
@stnguyen90 stnguyen90 added the question Further information is requested label May 15, 2024
@Krijestorac
Copy link

I got the same issue for this code as well. Can someone help?

@KyuubiTila
Copy link

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?

@Suvrajit69
Copy link
Author

Suvrajit69 commented May 29, 2024

@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.

@stnguyen90 stnguyen90 closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants