There is no mention of being able to use GitHub deployment to manage hooks.
So simple question, can hooks be managed using GitHub deployments extension or only via the methods (dashboard, management API and CLI) mentioned in the hooks documentation?
I guess there might be some mistake in the first doc. Indeed, you can use dashboard, Management API and CLI to manage Hooks, that’s for sure.
I just checked the GitHub Deployments extension doc you mentioned and there is one mention about hooks but nothing more than that so I would assume that it’s not doable to manage hooks using that tool as the doc doesn’t mention precisely how to achieve that. Will relay it to our docs team
In order to do so create a hooks directory the root of your repository. In that folder for each hook create 2 files: .js file for the hook itself and .json file to make this work. The structure of .js file is the same as it would be in the dashboard. In my case .json file looks something like that
Beware that when you deploy a code with a hook it does not rewrite the old one, it just creates a new hook. And since Auth0 has its limitations about the number of hooks after some number of deploys you will not be able to deploy your repository until you delete some of your hooks.
All that was written above works for pre-user-registration hook.
If you need hook for other event, then try using one of the following: credentials-exchange , post-user-registration , post-change-password .
The problem is I tried to create a Post Registration Hook with similar structure (by replacing the name and the triggerId), but on every deploy I was receiving the error like this one:
Problem creating hooks {"name":"PostRegistrationHook","triggerId":"post-user-registration"}
APIError: {"statusCode":400,"error":"Bad Request","message":"Error: Webtask error Invalid payload: ValidationError: child \"meta\" fails because [child \"auth0-extension-secret\" fails because [\"auth0-extension-secret\" is not allowed to be empty]]","errorCode":"WebtaskError"}
Found solution to my problem. It seems that you can successfully deploy hooks only if you do not have any active ones in your Auth0 application at the moment of deploy. The error message is confusing, but in fact you just have to disable/delete the currently active hook.
Also, I wasn’t able to create a configs directory for hooks, so using the mappings was the solution for me to store some values.
We are aware of that. I relayed the feedback to our product team and the best I can do to advocate for this feature is to mention that again. Will do that! The more people advocate for this feature of course the more likely it is to get implemented. As of now there is no ETA on that.
Thanks for the response.
If there is no ETA for the fix, it would be good to be able to add hooks to excluded list and ignore for time being (same as Clients, Rules etc.)