Hello Community team!
We are now releasing a new Rules migration tooling! Migrating from Auth0 Rules to Actions is a straightforward but essential task due to the planned deprecation of Rules. With the latest migration tooling release, this task has been made super simple. We strongly recommend that you first verify the conversion from your Rule to Action in a non-production Tenant and, once satisfied, only then proceed to migration on your production tenant.
Here’s a concise guide on how to perform the migration:
-
Identify the Rule to Migrate: Start by selecting the specific Rule you want to convert form within Auth Pipeline > Rules section of the Auth0 dashboard. Keep in mind that the order in which you migrate over Rules matters, so you can pick the last Rule first as Actions execute after Rules, so you wont break your current execution order.
-
Select Migrate to Action: You will see the button “Migrate to Actions” against the respective rule to start the process
- Give the target Action a descriptive name
- Select the preferred Run time (Node 18 is recommended)
-
Alternatively you can create a new Actions yourself or select an existing Action and from there you can access the “Rules” menu in the left nav of the Actions editor and select the Rule to migrate
-
-
Rewrite the Rule as an Action: At this stage you will be at the Actions editor page with a split window showing the Rule to migrate alongside the Action you can author.
- We will automatically identity and highlight syntax differences within the Rules window
- You can simply copy the Rule’s code over to the Actions section and see the same highlighted sections of your code which require modification
- Now you can hover over the highlighted parts and select “Quick Fix” to get a recommendation on how to update to Actions compatible syntax.
Selecting a recommendation from Quick Fix (where available) will automatically replaces the old Rules syntax with the recommended Actions syntax. For some cases you may not find a Quick Fix option, but instead an explanation on how to address the difference.
- Address all the highlighted parts and now you’re new Actions code is ready for next steps.
-
Validate the Action: You can now use the Actions test feature to simulate a transaction and verify that the Action is working as intended. You can find more details on how to test Actions which have not been deployed as yet.
-
Deploy and Integrate: Once validated, proceed to deploy the Action and drag it into the appropriate Login flow in the Auth0 dashboard.
- You would have noticed that the we had automatically added a condition that would prevent the new Action to execute if the corresponding Rule was still active which makes it safe to deploy at this stage.
if (api.rules.wasExecuted("<ruleId>")) {
return;
- Disable the Old Rule: Now proceed to disable the old Rule and run an actual transaction to validate the Action is functional as expected. Once satisfied, you can leave the Rule in a disabled state, otherwise you can debug leveraging details provided here.
For more detailed guidance and examples, you can refer to the official Auth0 documentation on migrating from Rules to Actions.