I can not verify user mails. I always get invalid verification link.

My mail configuration:
verifyUserEmails: true,
emailVerifyTokenValidityDuration: 48 * 60 * 60, // in seconds (2 hours = 7200 seconds)
preventLoginWithUnverifiedEmail: false,
I checked for the verification token in the database:

It does set both values correctly after changing the mail address of a user.
This is the verification link it generates:
https://myserver.com/parse/apps/skgjhsfgkjhkjhsfdgkjh/verify_email?token=XmLufY59n3gMxDWQi5mOI6q5Z&username=funkenstrahlen
This does look very promising.
Mail is verified
Invalid verification link error
Server
Database
Thanks for reporting the issue! Any chance you want to attempt to fix it?
@flovilmart I already had a look at the code but could not find the source of the issue. Unfortunately I can not provide a PR with a fix in this case.
We鈥檒l have a look then!
I initially thought that this issue might be related: https://github.com/parse-community/parse-server/issues/4369
However as you can see in my bug report I confirmed the expiration times are correct.
This is the relevant area in the code: https://github.com/parse-community/parse-server/blob/db8594dd33566af7bd51da93658f85bf735fdcb1/src/Controllers/UserController.js#L44-L70
Even after reading it many times I can not find the problem
I discovered the problem! I do have some before save cloud code trigger on the user object. I expected request.original to always be set in my cloud code. However when the before save is triggered by the request to update the mail verification request.original is undefined.
In this case my before save trigger failed and therefore the database update request failed.
Most helpful comment
I discovered the problem! I do have some before save cloud code trigger on the user object. I expected
request.originalto always be set in my cloud code. However when the before save is triggered by the request to update the mail verificationrequest.originalis undefined.In this case my before save trigger failed and therefore the database update request failed.