Kuovonne's Guide to Scripting in Airtable
Share
Explore
Automation Scripts

Automation script limits

Your donations tell Kuovonne that you value her content and want her to continue publishing.
Automation scripts are subject to several limits that do not apply to Scripting Extension. The script will fail when any of the limits are reached, potentially leaving the script in a partially executed state.
ok
Because these limits are checked at run-time, automation scripts can be successful when testing the automation, but fail later on when processing real-world data.

Limit specific recommendations

30 seconds run time

If your script takes longer than 30 seconds to run, the automation action will fail. Here are some ideas for reducing run time.
Create, update, and delete records in batches, not one at a time. Avoid creating, updating, and deleting records inside nested loops.
Limit the number of times you query for record data. Avoid querying for data inside nested loops.
Instead of iterating over an array multiple times searching for matching data, use a hash index.
Do not await API calls if you do not need the response.

512 MB memory usage

If your script uses more than 512 MB of memory, the automation action will fail.
The most common way to reducing memory usage is to load less data.
Limit how many fields you read when querying for record data to only the fields you actually need.
Consider querying a filtered view instead of the entire table.
It is also possible to reduce memory usage by being careful in how memory is allocated and freed up (garbage collection). In JavaScript, memory management happens automatically, but how you write your code can have an impact on memory usage. For example, variables that exist only inside a function take up memory only while the function is being executed—once the function is done, that memory is released.

Fetch / API call timeouts

If your script makes an API call that does not return a response within 12 seconds, the automation action will fail.
If you do not need to know if the API call was successful or use any data from the response, you can make the call without awaiting the response. Remove the keyword await from the call, and do not assign the value to a variable.
If you need information returned from the API call, there is not much that you can do. If the API call usually returns in a timely manner, you can accept that the automation script may occasionally fail and deal with it then. If you expect the API call to routinely take a long time, look into a third party solution.

50 Fetch requests / API call quantity

If your script makes more than 50 fetch requests (API calls), the automation action will fail.
One approach to dealing with this limit is to reduce the number of API calls.
Avoid using fetch requests in loops.
See if the API call accepts batch requests.
Another approach is to track the number of fetch requests your script performs and stop gracefully once the limit is reached.

30 Select Queries

If your script makes more than 30 select queries, the automation action will fail.
The main approach for dealing with this limit is to reduce the number of select queries. Avoid querying for records inside nested loops. For read-only data, query the tables you need once at the beginning of the script. For example, when you process an array of parent records and need the linked child records, do not query for the child records as you process each parent record. Instead, query the child table once up front. Then as you process the parent records, get the linked child records from the existing query result.
However, sometimes you need to perform fresh queries because you need updated values from a formula or rollup. In these cases, you can track the number of queries your script performs and stop gracefully once the limit is reached.

Mutation rate limit

If your script makes more than 15 requests per second to create, update, or delete records, the automation action will fail. Note that this limit is the same for both automation scripts and scripting extension.
As long as you await each create, update, or delete records request you should not have to worry about this limit.

General guidelines

Techniques within an automation script

Avoid nested loops. Use batch processes and hash indexes instead.
Limit querying for data. Avoid querying the same table multiple times. Query for only the fields you need. Consider querying a filtered view instead of the entire table.
If you think your script might run out of time or requests, track the time or number of requests and have your script end gracefully before the limit is reached.

Other techniques

Have the script process only one record at a time and put it inside a repeating action group.
Using Scripting Extension instead of an automation script.
Breaking up your script into multiple scripts and chaining them together using input variables.
The content in this guide is free, but creating it takes time and money. If you like this content, .

Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.