Hi! I am currently trying to create an action which is Post Registration and creates some App Metadata for the user. However, even if I break down my code into just these few lines:
exports.onExecutePostUserRegistration = async (event, api) => {
api.user.setAppMetadata(“key”, “value”);
};
It still throws the following error:
“Cannot read properties of undefined (reading ‘setAppMetadata’)”
I already have searched the forums but I’m still unable to find a solution. Any help is very appreciated! Thank you so much in advance!!
tyf
May 10, 2024, 9:06pm
3
Hey @anonetics welcome to the community!
Sorry for the delayed response here - As noted in the following post, adding app and or user metadata to users should be done in pre registration or post login actions:
Hi @techdynamism ,
I just tested out your code in my own tenant, and it seems to make the update on the user, although the user ID is referenced with event.user.user_id instead of event.user.id. You can find the post-user registration event object here: Actions Triggers: post-user-registration - Event Object . It might be helpful to log the secrets to make sure they contain the correct credentials and don’t contain quotes, etc.
As a side note, since you are updating app metadata, you may want to…
system
Closed
May 31, 2024, 8:49am
5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.