# What is the JS version?

**URL:** <https://community.fibery.io/t/what-is-the-js-version/4837>\
**Category:** API & Programming\
**Created:** [July 23, 2023, 7:03am UTC](https://community.fibery.io/t/what-is-the-js-version/4837 "2023-07-23T07:03:56Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ooker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/ooker/32/7033_2.png) [@Ooker](https://community.fibery.io/u/Ooker)\
**Post date:** [July 23, 2023, 7:03am UTC](https://community.fibery.io/t/what-is-the-js-version/4837/1 "2023-07-23T07:03:56Z")

</div>

It doesn’t support `replaceAll()`, so I guess it must be Node 14 or below. Is there a way to check the exact version? And why do you not update it?

---

<div class="post-metadata">

**Author:** ![Viktar\_Zhuk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/viktar_zhuk/32/1934_2.png) [@Viktar\_Zhuk](https://community.fibery.io/u/Viktar_Zhuk)\
**Post date:** [July 23, 2023, 3:07pm UTC](https://community.fibery.io/t/what-is-the-js-version/4837/2 "2023-07-23T15:07:35Z")

</div>

Hi Ooker,

> Is there a way to check the exact version?

There is no known way. We do not allow execution of JS code in plain Node env, your code will be sandboxed. As I see it in our documentation, sandboxed process is executed with Node API more-like 12-ish version.

> And why do you not update it?

We do not “own” this piece of software. I’d not expect updates in anytime soon.

---

<div class="post-metadata">

**Author:** ![Ooker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/ooker/32/7033_2.png) [@Ooker](https://community.fibery.io/u/Ooker)\
**Post date:** [July 23, 2023, 6:37pm UTC](https://community.fibery.io/t/what-is-the-js-version/4837/3 "2023-07-23T18:37:43Z")

</div>

Why is there no way to know this? Why doesn’t you own it?

---

<div class="post-metadata">

**Author:** ![Viktar\_Zhuk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/viktar_zhuk/32/1934_2.png) [@Viktar\_Zhuk](https://community.fibery.io/u/Viktar_Zhuk)\
**Post date:** [July 24, 2023, 8:41am UTC](https://community.fibery.io/t/what-is-the-js-version/4837/4 "2023-07-24T08:41:25Z")

</div>

> Why is there no way to know this?

I meant that there is no way to do it by code in the script itself, like asserting process.version. Those things just don’t available in sandbox process. Furthermore it is sandboxed in a way that only selected functions, global objects and methods are available, so it won’t be complete JS api in any case.

> Why doesn’t you own it?

Let’s say we have access to source codes, however it is fairly complicated. We do not have time and resources right now to invest in it in this regard.

We have a fairly decent code completion in our JS editor, so you can see which methods are available. Could you describe what for you need the exact version?

---

<div class="post-metadata">

**Author:** ![Ooker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/ooker/32/7033_2.png) [@Ooker](https://community.fibery.io/u/Ooker)\
**Post date:** [September 7, 2023, 6:09am UTC](https://community.fibery.io/t/what-is-the-js-version/4837/5 "2023-09-07T06:09:36Z")

</div>

In my understanding top-level await is supported only starting from Node 14. Why can we still use top-level await in the automation script?

```js
const Fibery = require('fibery-unofficial');
const fibery = new Fibery({host: "YOUR_ACCOUNT.fibery.io", token: YOUR_TOKEN});

await fibery.entity.updateBatch([
  {
    'type': 'Cricket/Player',
    'entity': {
      'fibery/id': '20f9b920-9752-11e9-81b9-4363f716f666',
      'Cricket/Full Name': 'Virat \"Chikoo\" Kohli',
      'Cricket/Current Team': { 'fibery/id': 'd328b7b0-97fa-11e9-81b9-4363f716f666' }
    }
  }
]);

```

Also, is the sandboxed process a docker container?

---

<div class="post-metadata">

**Author:** ![Ooker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/ooker/32/7033_2.png) [@Ooker](https://community.fibery.io/u/Ooker)\
**Post date:** [February 1, 2025, 10:04am UTC](https://community.fibery.io/t/what-is-the-js-version/4837/6 "2025-02-01T10:04:02Z")

</div>

From [Scripts in Automation](https://the.fibery.io/@public/User_Guide/Guide/Scripts-in-Automations-54):

> The scripts are executed with Node.js 12, so feel free to use async/await and other recent JS features.

The oldest version that support async/await is 14.8.0. So what the exact version here?

---

<div class="post-metadata">

**Author:** ![Viktar\_Zhuk](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/viktar_zhuk/32/1934_2.png) [@Viktar\_Zhuk](https://community.fibery.io/u/Viktar_Zhuk)\
**Post date:** [February 1, 2025, 12:50pm UTC](https://community.fibery.io/t/what-is-the-js-version/4837/7 "2025-02-01T12:50:08Z")

</div>

Where did you get this info? Afaik async await is available not only in Nodejs v12 but much earlier.

---

<div class="post-metadata">

**Author:** ![Ooker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/ooker/32/7033_2.png) [@Ooker](https://community.fibery.io/u/Ooker)\
**Post date:** [February 1, 2025, 6:32pm UTC](https://community.fibery.io/t/what-is-the-js-version/4837/8 "2025-02-01T18:32:45Z")

</div>

From MDN. I forgot to specify that I’m referring to the top level await

> **[await - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#browser_compatibility)**
>
> The await operator is used to wait for a Promise and get its fulfillment value. It can only be used inside an async function or at the top level of a module.

---

<div class="post-metadata">

**Author:** ![itsu](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/itsu/32/1775_2.png) [@itsu](https://community.fibery.io/u/itsu)\
**Post date:** [February 1, 2025, 9:36pm UTC](https://community.fibery.io/t/what-is-the-js-version/4837/9 "2025-02-01T21:36:35Z")

</div>

I can confirm that Node 12 is being used. While it may look like top-level await, it really is not. This solves the mystery! 🙂

---

<div class="post-metadata">

**Author:** ![Ooker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/ooker/32/7033_2.png) [@Ooker](https://community.fibery.io/u/Ooker)\
**Post date:** [February 2, 2025, 3:40am UTC](https://community.fibery.io/t/what-is-the-js-version/4837/10 "2025-02-02T03:40:40Z")

</div>

So what is it if it’s not top-level await? And what’s your recommendation for bundling scripts? I use esbuild with target `node12` and it refuses to bundle for having top-level await.

---

<div class="post-metadata">

**Author:** ![itsu](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/itsu/32/1775_2.png) [@itsu](https://community.fibery.io/u/itsu)\
**Post date:** [February 2, 2025, 9:24am UTC](https://community.fibery.io/t/what-is-the-js-version/4837/11 "2025-02-02T09:24:56Z")

</div>

I see how tooling can be confused by this: it looks like top-level await, but in reality, it’s wrapped in a function. I think using the `node12` target is still correct as it matches what we use internally. You can also wrap your code in a function like this:

```auto
async function main() {
    await <something>;
}

main();

```

---

<div class="post-metadata">

**Author:** ![Ooker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/ooker/32/7033_2.png) [@Ooker](https://community.fibery.io/u/Ooker)\
**Post date:** [February 2, 2025, 5:16pm UTC](https://community.fibery.io/t/what-is-the-js-version/4837/12 "2025-02-02T17:16:50Z")

</div>

[My code](https://github.com/QuaCau-TheSphere/CA-Bao-hiem/blob/main/dist/Code%20ch%E1%BA%A1y%20tr%C3%AAn%20Fibery.js) is like:

```js
async function main() {
  for (const entity of args.currentEntities) {
    ...
    await http.postAsync(url, { body: obj });
    ...
  }
}
main();

```

And it results with:

```auto
Failed to execute Action "Script": Execution completed but 13 of 17 promises created during execution left in unfulfilled state. Most likely you miss 'await' keyword somewhere.

```

It should have maximum 3 promises though, as only one entity is triggered. I still need to use `await main()`. For now using the `node15` target is fine for me, but I still want to understand the problem and use `node12`. Any idea?

---

<div class="post-metadata">

**Author:** ![Sergey\_Truhtanov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/sergey_truhtanov/32/13986_2.png) [@Sergey\_Truhtanov](https://community.fibery.io/u/Sergey_Truhtanov)\
**Post date:** [February 3, 2025, 9:48am UTC](https://community.fibery.io/t/what-is-the-js-version/4837/13 "2025-02-03T09:48:01Z")

</div>

Hello.  
Suggestion above

```auto
async function main() {
    await <something>;
}

main();

```

is not correct. You should explicitly wait for all promises in your script code, otherwise you will get “non-completed promises” exception indeed.

We use node 12 as mentioned above. Nodejs upgrade is not a priority for now, but we will do it at some point in time.

If you want to develop your script outside of Fibery UI, you are free to do this. Just notice that your code is run in sandboxed environment and there can be some differences and limitations in comparison to usual nodejs.  
I can’t recommend any particular approach to write code outside fibery UI.

---

<div class="post-metadata">

**Author:** ![Ooker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/ooker/32/7033_2.png) [@Ooker](https://community.fibery.io/u/Ooker)\
**Post date:** [February 4, 2025, 10:48am UTC](https://community.fibery.io/t/what-is-the-js-version/4837/14 "2025-02-04T10:48:41Z")

</div>

Follow-up Stack Overflow question: [javascript - Is it possible to tell esbuild to ignore top-level await when bundling to node12 target? - Stack Overflow](https://stackoverflow.com/q/79411394/3416774)

---

<div class="post-metadata">

**Author:** ![Sergey\_Truhtanov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/sergey_truhtanov/32/13986_2.png) [@Sergey\_Truhtanov](https://community.fibery.io/u/Sergey_Truhtanov)\
**Post date:** [April 14, 2025, 9:11am UTC](https://community.fibery.io/t/what-is-the-js-version/4837/15 "2025-04-14T09:11:17Z")

</div>

Script engine was upgraded to Nodejs 22, so feel free to use all recent apis and language features.

Editor on UI is not yet familiar with some recent Nodejs apis (like Array.flatMap for example), so you may see them underlined with red. But it should work okay. We will fix it with future releases.

---

<div class="post-metadata">

**Author:** ![helloitse](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/helloitse/32/498_2.png) [@helloitse](https://community.fibery.io/u/helloitse)\
**Post date:** [April 14, 2025, 1:56pm UTC](https://community.fibery.io/t/what-is-the-js-version/4837/16 "2025-04-14T13:56:40Z")

</div>

This is an exciting update! Do we now have http.patchAsync support?

---

<div class="post-metadata">

**Author:** ![Sergey\_Truhtanov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/sergey_truhtanov/32/13986_2.png) [@Sergey\_Truhtanov](https://community.fibery.io/u/Sergey_Truhtanov)\
**Post date:** [April 14, 2025, 3:07pm UTC](https://community.fibery.io/t/what-is-the-js-version/4837/17 "2025-04-14T15:07:46Z")

</div>

Unfortunately no.  
“http” api is our own code for providing users possibility to make http requests. Basically it’s a wrapper around some nodejs library, with many limitations.  
It’s a separate part of work to add methods there. I’ll check how easy is to add `patch` (should be very easy) and maybe do this, but no promises.

---

<div class="post-metadata">

**Author:** ![Sergey\_Truhtanov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/sergey_truhtanov/32/13986_2.png) [@Sergey\_Truhtanov](https://community.fibery.io/u/Sergey_Truhtanov)\
**Post date:** [April 14, 2025, 4:18pm UTC](https://community.fibery.io/t/what-is-the-js-version/4837/18 "2025-04-14T16:18:22Z")

</div>

I’ve added `patchAsync` api to http. Enjoy 🙂

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [April 29, 2025, 11:27am UTC](https://community.fibery.io/t/what-is-the-js-version/4837/19 "2025-04-29T11:27:12Z")

</div>


