Back

[SOLVED] Error on Account Verification

  • 0
  • Users
  • Accounts
  • Web
hosnipogi
8 Mar, 2023, 22:38

Hello, not sure if this is a bug or I just might be overlooking something. Im trying to verify (using account.createVerification method) my previously anonymous users (anonymousSession), now with updated emails, but I keep getting the following server error:

TypeScript
{
    "message": "Server Error",
    "code": 500,
    "type": "general_unknown",
    "version": "1.2.0"
}

its on this route: db/v1/account/verification

The issue seems to only occur on users who were previously using anonymousSession. My SMTP configuration is correct because I could successfully send a verification url to users if created via the account.create method.

I tried it in both front and backend and the issue happens only to users previously on anonymous sessions. Here is basically the auth order of my code:

TypeScript
const anon = await appwrite.account.createAnonymousSession();
const { jwt } = await appwrite.account.createJWT(); // also using session in the backend 
const user = await appwrite.account.updateEmail(val.email, val.password); // coming from form
await appwrite.account.createEmailSession(user.email, val.password);
await appwrite.account.createVerification(
  `${window.location.href}account-verify`
); 

In the end I always get a 500.

TL;DR
Users who were previously created via anonymous sessions are encountering a 500 error when trying to verify their account. The issue is that the 'name' is set to null during anonymous user creation, which causes the verification to fail. To solve this, the name should be updated before attempting verification. The error message is: "Appwrite\Event\Mail::setName(): Argument #1 ($name) must be of type string, null given." If encountering a 500 error, check the Docker logs from the appwrite container for more details.
Drake
8 Mar, 2023, 22:54

if you get a 500 error, you'll need to check the docker logs from the appwrite container to see details of the 500 error

Drake
8 Mar, 2023, 22:55

the code you shared is for the create verification, but you said you're getting an error during update verification. what's that code?

hosnipogi
9 Mar, 2023, 04:15

Hello! Im getting the error upon invoking the account.createVerification method, only when the users where previously created via anonymous sessions

hosnipogi
9 Mar, 2023, 04:16

Yes, can you tell me which container do I check the logs for?

Drake
9 Mar, 2023, 04:17

appwrite

hosnipogi
9 Mar, 2023, 07:52

Okay, this is now resolved thank you! the issue was name was set to null when a user is created anonymously. So we need to update the name as well in order to verify user. Here was the log:

TypeScript
[Error] Message: Appwrite\Event\Mail::setName(): Argument #1 ($name) must be of type string, null given, called in /usr/src/code/app/controllers/api/account.php on line 2159
hosnipogi
9 Mar, 2023, 07:52

[SOLVED] Error on Account Verification

Drake
9 Mar, 2023, 15:29

Any chance you can create a GitHub issue with all this information? Ideally, Appwrite should handle this better and not give a 500 error

hosnipogi
9 Mar, 2023, 15:29

sure!

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