verifyUserAttribute does not appear to send clientMetadata
See original GitHub issueDescribe the bug
While implementing MFA I’m attempting to add a phone number attribute to the user. UpdateUser works fine (though it doesn’t trigger the CustomMessage_UpdateUserAttribute lambda, but that’s not an amplify issue).
When I call Auth.verifyUserAttribute(user, 'phone_number', { product: 'myProductName' }
the cloudwatch logs show no clientMetadata
property in the event.
Error from my backend code:
{code: "UserLambdaValidationException", name: "UserLambdaValidationException", message: "CustomMessage failed with error Unsupport product undefined."}
To Reproduce Steps to reproduce the behavior:
- Create a pool with a user that has an unverified phone number, and a CustomMessage trigger
- Use the Amplify package to call
verifyUserAttribute
for that user and pass the third parameter some object; - Check the logs of the CustomMessage trigger and see something like
"triggerSource": "CustomMessage_VerifyUserAttribute",
"request": {
"userAttributes": {
"sub": "<sub>",
"email_verified": "true",
"cognito:user_status": "CONFIRMED",
"cognito:email_alias": "<email>",
"phone_number_verified": "false",
"phone_number": "<phone>",
"given_name": "Michael",
"family_name": "Riffle",
"email": "<email>"
},
"codeParameter": "{####}",
"linkParameter": "{##Click Here##}",
"usernameParameter": null
},
Expected behavior
The request
property should have a clientMetadata
property that was passed into the function.
Code Snippet Please provide a code snippet or a link to sample code of the issue you are experiencing to help us reproduce the issue. (Be sure to remove any sensitive data)
async verifyUserAttribute() {
try {
const user = await Auth.currentAuthenticatedUser();
if (!user) {
throw new Error('User must be initialized to verify attributes');
}
const res = await Auth.verifyUserAttribute(user, 'phone_number', {
product: process.env.REACT_APP_PRODUCT,
});
} catch (err) {
throw err;
}
}
Additional context We’re using lambda triggers from cognito for a bunch of other use-cases and everything is working fine. Our app supports CustomMessage_SignUp CustomMessage_ResendCode CustomMessage_ForgotPassword PostConfirmation_ConfirmSignUp PostAuthentication_Authentication And they all work great. This might be an issue lower down with Cognito itself? But I wanted to check here first.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
Hi @rifflock - thanks for filling this. I was able to reproduce this error on my end. Let me check-in with the team on how to move forward.
This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels or Discussions for those types of questions.