Await is only valid in async functions and the top level bodies of modules

Hi @samad324! Top-level await has been feature flagged for self-hosted instances up until 2.87, there are three options here:

  1. Upgrading to Retool v2.87+
  2. I can set the feature flag for your instance that enables top-level await
  3. Using an async wrapper for your JS query:
return (async () => {
  /* some of your script here! */
  await queryGetUser.trigger();
  await queryUpdateUser.trigger();
  /* the rest of your script here! */
})();

For anyone following along, this feature is available by default on Cloud