Back

Possible unhandled promise rejection; Missing required parameter: "email"

  • 0
  • React Native
kalajian
25 Aug, 2024, 16:47

Hi there,

I have what looks like a strange issue: I am getting a Warning about a possible unhandled promise rejection, that says "Error: AppwriteException: Missing required parameter: "email"" and it's pointing to my "throw" statement in a try/catch block:

TypeScript
    try {
        const newAccount = await account.create(
            ID.unique(),
            email,
            password,
            username
        );

        if(!newAccount) throw Error;

        const avatarUrl = avatars.getInitials(username);

        await signIn(email, password);

        const newUser = await databases.createDocument(
            appwriteConfig.databaseId, 
            appwriteConfig.userCollectionId, 
            ID.unique(), 
            {
                accountId: newAccount.$id,
                email,
                username,
                avatar: avatarUrl,
            }
        );

        return newUser;
    } catch (error) {
        throw new Error(error);
    }
}```

Any ideas?
TL;DR
Possible unhandled promise rejection error due to missing "email" parameter. Check that the "email" parameter is being passed correctly. Fix by ensuring the "email" parameter is included when calling the function in the createUser 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