Post Change Password hook signature

According to the documentation, the signature for the Post Change Password hook should be:

function (user, context, cb)

However, when I try this, I get the following error:

{
    "code": 500,
    "error": "Script generated an unhandled synchronous exception.",
   "details": "TypeError: cb is not a function",
}

When I tried to add a 4th parameter I got

{
    "code": 400,
    "message": "Invalid webtask code",
    "error": "The JavaScript compiledFunction must have one of the following signatures: ([ctx], callback) or (ctx, req, res)."
}

It seems like I’m able to make it work by using

function (context, cb)

and then retrieving the user from context.body.user.

Is this correct?
Could you update the documentation please?

Thanks

Hey there!

Let me pass it to the team responsible for the hooks functionality. I’ll get back to you soon!

I managed to get the info back. This is a known issue and captured in an existing ticket. We have a fix for this issue that will be released in the next few days.

As a workaround, if you delete this extension and recreate it in the manage dashboard with the hooks code editor UI, the hook should work as expected.

The “callback is not a function” error only happens with hooks created via the Management API, but hooks created in the UI do not have this issue.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.