Problem statement
We need to begin migrating their existing Rules and Hooks to Actions as Rules and Hooks will reach the end of life on November 18, 2024.
Symptoms
Key Dates for the Deprecation
-
October 16, 2023 - Rules and Hooks will no longer be available for tenants of new and existing customers.
-
Existing tenants that are making use of Rules and Hooks will maintain access to those features until EOL but are highly encouraged to start the migration to Actions as soon as possible**.**
-
November 18, 2024 - Rules and Hooks will reach the end of life and will be removed from all tenants .
Solution
Migrating from Hooks to Actions can be broken down into four main steps:
- Plan your migration: Deployed Actions run after active Hooks, so you can either convert Hooks one at a time in the Dashboard or all at once using the Management API. Tips when planning your migration:
- Use flags to avoid duplicating expensive or one-time operations.
- Make sure to run changes at a time when impact and traffic will be lowest.
- Consider using the Auth0 Deploy CLI to script, test, and quickly implement the migration all at once or iteratively.
- Understand limitations: While Actions can handle the vast majority of things that Hooks can, you should be aware of a few limitations before you start your migration. (Remember: you can have both Hooks and Actions running as you migrate.)
- Actions cannot persist data, like access tokens or API responses, across executions.
- Actions are not provided with an access token for the Management API or access to the global auth0 object as in Hooks.
For the full list of limitations, see Actions Limitations.
- Convert code: To convert a Hook to an Action, you must replace Hook-specific code with Actions code. This section covers the tasks you will need to perform to turn a functioning Hook into its equivalent Action. Tips when converting code:
- In general, look for the read-only properties of objects passed into the Hooks function on the Actions event object.
- Use the Actions Code Editor in the Auth0 Dashboard to write your code; it will help by highlighting errors and supplying auto-complete suggestions.
- Before you go live, thoroughly test your new Actions in a staging or test environment.
- Complete the migration: Once your new Actions code has been written and tested, you must activate the Action and deactivate the Hook. These two tasks can be done quickly in succession, but depending on the order, there might be a short period of time where either both or neither are running. Because active Hooks run before deployed Actions, you can keep some logic in Rules as you build and test other logic in Actions.