Auth0 deploy client did not deploy actions

When deploying auth0 config with deploy cli tool the action does not get bound to the flow. It needs to be manually dragged in the dashboard to the login flow.

Is there a way to get the action automatically added to the login flow?

The config is in json file auth0-config/actions/post-login-action.json

{
  "name": "post-login-action",
  "code": "post-login-action.js",
  "runtime": "node16",
  "status": "built",
  "dependencies": [
    {
      "name": "node-fetch",
      "version": "2.6.1"
    }
  ],
  "secrets": [
    ...
  ],
  "supported_triggers": [
    {
      "id": "post-login",
      "version": "v2"
    }
  ],
  "deployed": true
}
1 Like

I am facing the same problem today. I want to add an action to the pre-user-registration flow. Were you able to figure out a fix for this, @mhautala ?

I also attempted doing this in yaml syntax as suggested at Auth0-deploy-cli yaml configuration: Add an action to a flow but that doesn’t even create the action, let alone deploy and then add to the action.

Any suggestions, anybody?

Hey there!

As this topic is related to Actions and Rules & Hooks are being deprecated soon in favor of Actions, I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!

Hey @mhautala and @abhilash.gupta.

Thanks for your contribution to our Community. I believe your questions have not been answered in detail so I have come to elaborate with an example.

I can see my colleague Dan has detailed how to do this with YAML here but there were no direct examples for JSON. Please see below for a JSON/directory example.

Using @mhautala 's example above let’s assume we have the following config file in the directory auth0-config/actions/post-login-action.json:

{
  "name": "post-login-action",
  "code": "post-login-action.js",
  "runtime": "node16",
  "status": "built",
  "dependencies": [
    {
      "name": "node-fetch",
      "version": "2.6.1"
    }
  ],
  "secrets": [
  ],
  "supported_triggers": [
    {
      "id": "post-login",
      "version": "v2"
    }
  ],
  "deployed": true
}

The corresponding code file is in the same directory as above with filename post-login-action.js

exports.onExecutePostLogin = async (event, api) => {
};

Finally the actual binding to flow is called a ‘trigger’. This file is located in the directory: /auth0-config/triggers/triggers.json (please note that the ‘action_name’ needs to match the ‘name’ of the action as defined above, the ‘display_name’ can be set to change the name on the actual flow)

{
  "post-login": [
    {
      "action_name": "post-login-action",
      "display_name": "post-login-action"
    }
  ]
}