# Does the account link extension rule finish before executing the next rule?

**URL:** <https://community.auth0.com/t/does-the-account-link-extension-rule-finish-before-executing-the-next-rule/43345>\
**Category:** Get Help\
**Tags:** auth0-rules, auth0\
**Created:** [May 20, 2020, 7:07pm UTC](https://community.auth0.com/t/does-the-account-link-extension-rule-finish-before-executing-the-next-rule/43345 "2020-05-20T19:07:09Z")\
**Posts on this page:** 4\
**Page:** 1

<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 20, 2020, 7:07pm UTC](https://community.auth0.com/t/does-the-account-link-extension-rule-finish-before-executing-the-next-rule/43345/1 "2020-05-20T19:07:09Z")

</div>

My objective is to enable account linking in our application, where users are primarily passwordless authenticated. After installing the extension and modifying the custom domain I tried logging in with a Google account, but it did not work - [question regarding this here](http://community.auth0.com/t/does-the-account-link-extension-support-passwordless-as-primary-account/43343).

Installing the extension adds a rule, so I opened the real-time logs to inspect the execution - and then I discovered something I did not understand. I have the account link rule placed as the first rule, and several other rules afterwards. But to my big surprise when expecting the real-time webtask logs, I get:

some output from account linking rule as expected  
output from the other rules  
and then: “Starting Account Link Extension - Version: 2.4.0” _after_ the other rules ended?

So my question is - **does the account link rule not await the process, or what is going on here**? I would expect the account linking to be done first, and then the execution of the other rules 😯

---

<div class="post-metadata">

**Author:** ![karen1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/karen1/32/18279_2.png) [@karen1](https://community.auth0.com/u/karen1)\
**Post date:** [May 28, 2020, 3:54pm UTC](https://community.auth0.com/t/does-the-account-link-extension-rule-finish-before-executing-the-next-rule/43345/2 "2020-05-28T15:54:56Z")

</div>

Good afternoon,

Each rule is executed as a JavaScript function called in the [order](https://auth0.com/docs/best-practices/rules#order) defined. The next rule in order won’t execute until the previous rule has completed.

Rule execution supports the asynchronous nature of JavaScript, and constructs such as [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) objects and the like can be used. Asynchronous processing effectively results in suspension of a pipeline pending completion of the asynchronous operation. An Auth0 serverless Webtask container typically has a circa 20-second execution limit, after which the container may be recycled. Recycling of a container due to this limit will prematurely terminate a pipeline—suspended or otherwise—ultimately resulting in an error in authentication being returned (as well as resulting in a potential reset of the [`global`](https://auth0.com/docs/best-practices/rules#global-object) object).

It may depend on the rule and the code you have written.

---

<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 30, 2020, 11:08am UTC](https://community.auth0.com/t/does-the-account-link-extension-rule-finish-before-executing-the-next-rule/43345/3 "2020-05-30T11:08:17Z")

</div>

Hi @karen1 - thanks for providing an answer. But please notice here that I’m not the author of [the account linking extension](https://auth0.com/docs/extensions/account-link), - Auth0 is.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 8, 2024, 8:21am UTC](https://community.auth0.com/t/does-the-account-link-extension-rule-finish-before-executing-the-next-rule/43345/4 "2024-01-08T08:21:46Z")

</div>

Hey there!

As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon, 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](https://community.auth0.com/t/auth0-community-ask-me-anything-rules-hooks-and-why-actions-matter/124043) 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!](https://community.auth0.com/t/auth0-community-ask-me-anything-rules-hooks-and-why-actions-matter/124043)
