# Issue with "Post Registration Action"

**URL:** <https://community.auth0.com/t/issue-with-post-registration-action/109744>\
**Category:** Get Help\
**Created:** [June 22, 2023, 7:50am UTC](https://community.auth0.com/t/issue-with-post-registration-action/109744 "2023-06-22T07:50:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![spatidar](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@spatidar](https://community.auth0.com/u/spatidar)\
**Post date:** [June 22, 2023, 7:50am UTC](https://community.auth0.com/t/issue-with-post-registration-action/109744/1 "2023-06-22T07:50:57Z")

</div>

The “Post User Registration” is going to call after user registration but always getting the below error inside monitor → logs

```auto
{
  "action_name": " assign-role-hook",
  "response": {
    "exception": {
      "code": 3,
      "error": 3,
      "message": "execution failed: bad status code: 500"
    },
    "stats": {
      "total_request_duration_ms": 219,
      "total_runtime_execution_duration_ms": 216,
      "runtime_processing_duration_ms": 140,
      "action_duration_ms": 6,
      "runtime_external_call_duration_ms": 70,
      "boot_duration_ms": 203,
      "network_duration_ms": 2
    }
  },
  "error": {
    "id": "invalid_argument",
    "msg": "Invalid Argument"
  },
  "started_at": "2023-06-22T07:15:24.352847681Z",
  "ended_at": "2023-06-22T07:15:24.572050658Z"
}

```

Below are the action flow and code

```auto
const axios = require('axios');
exports.onExecutePostUserRegistration = async (event, api) => {
  await axios({
      method: 'POST',
      url: 'https://dumy-url.com/qa/auth0/users',
      timeout: 30000,
      followRedirects: true,
      headers: {
        'x-api-key': 'x-api-key'
      },
      data: event.user
    });
};

```

 ![image](https://global.discourse-cdn.com/auth0/original/3X/2/6/26704b42992f5e0e78440aab2766ed67acdd5c62.png)

Also “Actions Logs BETA” is doesn’t display anything about runtime action logs. Not sure what is going on. Can you someone please look into this ?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [June 22, 2023, 6:37pm UTC](https://community.auth0.com/t/issue-with-post-registration-action/109744/3 "2023-06-22T18:37:31Z")

</div>

Hi @spatidar,

Welcome to the Auth0 Community!

Usually when a bad status code 500 is returned, it means that the URL you are trying to reach has an internal server error.

Have you gotten a chance to test your Action script with the built-in debugger?

 ![image](https://global.discourse-cdn.com/auth0/original/3X/1/8/18dbac64070f328983e458472cc9b2dc4fcd3a34.jpeg)

Let me also add that I have tried testing your URL in a browser and could not complete the request.

In the meantime, I will check the Action Logs Beta and see if are any issues with it.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![spatidar](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@spatidar](https://community.auth0.com/u/spatidar)\
**Post date:** [June 23, 2023, 7:51am UTC](https://community.auth0.com/t/issue-with-post-registration-action/109744/4 "2023-06-23T07:51:56Z")

</div>

Hi Rueben,

I didn’t mention the actual url. Also i ran from built-in debugger but getting the same issue. Even for below code getting same error.

```auto
const axios = require('axios');
exports.onExecutePostUserRegistration = async (event) => {
  console.log('Shailendra ' + event.user.given_name);
};

```

 ![image](https://global.discourse-cdn.com/auth0/original/3X/c/5/c5c67211105a47e6257bb7fb1df6784b58abadda.png)

One more thing, I removed the imported axios package and it worked but we need it to get token and persist the user into db.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/1/9/19510db589c3987cbad4997434c2a773ccadaed3.png)

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [June 23, 2023, 5:30pm UTC](https://community.auth0.com/t/issue-with-post-registration-action/109744/5 "2023-06-23T17:30:33Z")

</div>

Hi @spatidar,

Thanks for the update and clarification.

I have just tested this on my end and reproduced the same error you observed. Specifically, I had to be on either a `prod-us` or `prod-eu` tenant using Actions with Node 18 (beta). For some reason, it is preventing me from importing the Axios module.

However, if I create an Action with Node 16, I do not encounter any issues with importing the Axios module.

For the moment, I recommend using Actions with Node 16 runtime while I reach out to our engineers about this problem.

Once this issue is fixed, I will reach out again on this thread with an update.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![spatidar](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@spatidar](https://community.auth0.com/u/spatidar)\
**Post date:** [June 26, 2023, 8:54am UTC](https://community.auth0.com/t/issue-with-post-registration-action/109744/7 "2023-06-26T08:54:49Z")

</div>

Thanks @rueben.tiow , It’s working with Node 16.x

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [June 28, 2023, 4:20pm UTC](https://community.auth0.com/t/issue-with-post-registration-action/109744/9 "2023-06-28T16:20:39Z")

</div>

Hi @spatidar,

I have just checked with our Engineering team on this and learned that when using Actions with the Node 18 runtime, we must explicitly specify all of our dependencies.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/c/1/c15b406f3006de84713883bcfd7eb32ce8daef2b.png)

After adding the dependency you should be able to call the Axios module.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [July 12, 2023, 4:20pm UTC](https://community.auth0.com/t/issue-with-post-registration-action/109744/10 "2023-07-12T16:20:56Z")

</div>

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