How to set .topLevelAwait: true?

Hi, I am super new to Airtable scripts and I am stuck with trying to fix this error. It looks like I need to add the topLevelAwait module somewhere, but not sure where.

So far what I did was to install the Hello-World app in my localhost and then replaced the contents of index.js with the contents of the [YouTube Example Script](https://airtable.com/marketplace/scraGQUFvORtvmHC5/import-youtube-analytics) since it does similar things to what I need and I would like to learn from it.

The issue is that when I do a block release I am getting:

ModuleParseError: Module parse failed: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)
    File was processed with these loaders:
     * ../../../../usr/local/lib/node_modules/@airtable/blocks-cli/node_modules/babel-loader/lib/index.js
    You may need an additional loader to handle the result of these loaders.

Any help will be appreciated,
Thanks in advance!

1 Like

Running into the same problem. I can’t find anything else on topLevelAwait that’s explicitly related to Airtable, so must be a package that changed recently.

Welcome to the Airtable community!

Are you creating a script or a custom app?

It looks like you are trying to create a custom app. However, if you are new to scripting, creating a custom app might be a really big leap.

It is my understanding it is just a script not an app. I need to create a similar behavior to the script in the link.

Thanks!

What you’ve linked is a script, but the error and other info you shared in your original post are related to custom apps. In short, you followed the instructions for creating a custom app, not installing a script.

To use the script that you found, just click the “Add Script” button on that page you linked. It’ll ask you for a base where you want it added, and it will automatically add the Scripting app and insert the code into it.

2 Likes

you are totally right, that was the issue! thanks for pointing that out!

Cool! So for those of us who are building an app, has anyone encountered this and discovered a way to enable topLevelAwait?

Sorry, but I haven’t had the time to work on custom apps for a while, and I haven’t even heard of this top-level-await feature. After a quick search, it turns out that it’s not Airtable-specific. I’ll let this page explain further:

If you want to go beyond that, my gut says that your favorite search engine should turn up enough info.

1 Like

I’m familiar with the feature top-level-await, its usage, and its caveats! I was just hoping someone else here had tried it specifically with Airtable apps. I guess the answer is no. Thank you.

It’s only been two days since the initial post. I’d give it a bit more time before assuming that nobody here has used top-level-await with a custom Airtable app. (That said, this post will auto-close in three days because an earlier comment was marked as the solution, so it might be worth starting a new thread on this topic to keep the discussion going.)

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