#[SOLVED] LOG [AppwriteException: Invalid email: Value must be a valid email address]

50 messages · Page 1 of 1 (latest)

rocky crow
feral quarry
#

Email is empty

rocky crow
#

yeah i am taking inputs from user

feral quarry
#

Don't trigger it until the user clicks the send button and the variable is set with a valid email

rocky crow
feral quarry
#

Yes, you're passing the value to the function, but it's being triggered probably every frame while your app runs. Is that what's causing the prior rate limiting in your app?

rocky crow
#

yes you are right

feral quarry
#

You should then create a separate function and trigger it only when the button is being clicked

rocky crow
#

can we connect to a meet of possible

#

*if

feral quarry
#

I can't make calls, but I will be here for everything you need

rocky crow
#

ohh its okay

#

what changes i should make to solve this error
Invalid email: Value must be a valid email address

feral quarry
#

Your app workflow should be like that:

Button clicked-> variables set with the fields value-> data sent to appwrite

Alternative:
Variables changed every time the field changes (what you're currently making)-> button clicked-> send data to your appetite instance

#

So you will need in order to trigger with the button a separate function whe has your appwrite code

rocky crow
#

i did like this

const handleSignup = async () => {
const emailRegex = /^[^\s@]+@[^\s@]+.[^\s@]+$/;
if (!emailRegex.test(user.email)) {
console.log('Invalid email address:', user.email);
// Handle the error or display an error message to the user
} else {
// The email address is valid, proceed with the account creation
try {
const result = await account.create(
uuidv4(),
user.name,
user.email,
user.password,
);
console.log('User created:', result);
Alert.alert('Success', 'User created successfully.');
} catch (error) {
if (error.code === 429) {
// Rate limit exceeded, wait for some time before retrying
const waitTime =
error.response.headers['x-ratelimit-reset'] * 1000 - Date.now();
console.log(
Rate limit exceeded. Waiting for ${waitTime} milliseconds before retrying.,
);
await new Promise(resolve => setTimeout(resolve, waitTime));
handleSignup(); // Retry the signup process
} else {
console.log('Error creating user:', error);
Alert.alert('Error', 'Failed to create user.');
}
}
}

console.log('User name:', user.name);
console.log('User email:', user.email);
console.log('User password:', user.password);

};

#

output

feral quarry
# rocky crow

Are you triggering this when the button is clicked or every time the field changes?

rocky crow
#

when the button is clicked

#

i am triggering it

feral quarry
#

Seems like you're not setting things in the correct order

#

It's:
UserID
Email
Password
Name

#

Try placing them in such order

rocky crow
#

ohh okay

feral quarry
#

Tell me if that solves the issue

rocky crow
#

password problem

#

i gave 9 chars but even it is invalid

rocky crow
feral quarry
#

Seeing

rocky crow
#

kk

feral quarry
#

Are you sure everything is placed in the correct order?

#

Not only email, everything, like I've specified

#

I think you have the user name, as the password

rocky crow
#

the order is this right..

{"$createdAt": "2023-05-20T04:59:55.195+00:00", "$id": "2e01e8d9-e77b-49ab-93e2-b44351aac5bc", "$updatedAt": "2023-05-20T04:59:55.195+00:00", "email": "[email protected]", "emailVerification": false, "name": "Walter o'Brian", "passwordUpdate": "2023-05-20T04:59:55.194+00:00", "phone": "", "phoneVerification": false, "prefs": {}, "registration": "2023-05-20T04:59:55.194+00:00", "status": true}

rocky crow
feral quarry
#

And if you use 10 characters with 1 letter and symbol?

#

Maybe you're not meeting the password policy set

rocky crow
#

password required string
New user password. Must be at least 8 chars.

feral quarry
#

Make console.log(user.password) inside the account.create function

#

And send what the console shows

rocky crow
feral quarry
#

And what's the code for that?

#

(the account.create code)

rocky crow
#

thank you D5

#

you told me the correct sequence and order but i mistakenly did unordered

#

that was my mistake

#

🙂

feral quarry
#

Oh, perfect then, I thought there was any conflict with something else