# Async rule writing to a database on login, directly call callback?

**URL:** <https://community.auth0.com/t/async-rule-writing-to-a-database-on-login-directly-call-callback/42541>\
**Category:** Get Help\
**Tags:** rules, auth0\
**Created:** [May 7, 2020, 6:39am UTC](https://community.auth0.com/t/async-rule-writing-to-a-database-on-login-directly-call-callback/42541 "2020-05-07T06:39:58Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![alexab](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alexab/32/13403_2.png) [@alexab](https://community.auth0.com/u/alexab)\
**Post date:** [May 10, 2020, 12:48pm UTC](https://community.auth0.com/t/async-rule-writing-to-a-database-on-login-directly-call-callback/42541/4 "2020-05-10T12:48:16Z")

</div>

Hi Dan.

I am not sure I understand your answer?

If I configure this code to run:

```auto
function (user, context, callback) {
  var moment = require('moment-timezone');

  var data = { // Some data};
  var accessToken = 'YOUR INTERCOM ACCESS TOKEN';

  request.post({
    url: 'https://api.intercom.io/users',
    headers: {
      'Authorization': 'Bearer ' + accessToken,
      'Accept': 'application/json'
    },
    json: data
  }).catch(err => request.post({ // Will this code execute!? })
  callback(null, user, context);
}

```

I’m unsure if the above code in the catch(err) block will execute?

The log streaming sounds like the solution to this specific problem, but we are also working on other rules at the moment 🤓

Now that I have you attention, would you happen to know the answer for [this some-what related question](http://community.auth0.com/t/if-a-rule-in-auth0-calls-the-callback-with-error-will-the-next-continue/42546)?

---

_[View the full topic](https://community.auth0.com/t/async-rule-writing-to-a-database-on-login-directly-call-callback/42541)._
