Help

512MB memory limit in an automation script

Topic Labels: Automations
2691 4
cancel
Showing results for 
Search instead for 
Did you mean: 
Sergey_Filimono
5 - Automation Enthusiast
5 - Automation Enthusiast

I am trying to run the following script:

const tableDeals = base.getTable("Deals")
const queryDeals = await tableDeals.selectRecordsAsync()

And I am getting an error “Your script exceeded the 512MB memory limit.”.

Though the Deals table has only about 3500 records and weighs about 4 MB. What am I doing wrong and how can I fix this? Thanks!

4 Replies 4
SergioCodes
8 - Airtable Astronomer
8 - Airtable Astronomer

Do you have any updates from Airtable about this @Sergey_Filimonov ?

The selectRecordsAsync method automatically collects all fields from all records. This a) takes more processing time for large tables, and b) could potentially eat a lot of memory with high record counts and lots of fields and data. It’s best to only collect the fields needed later in the script. This is done by passing an object to selectRecordsAsync with a “fields” property that contains an array of field names.

const queryOrders = await base.getTable("Orders").selectRecordsAsync({
    fields: [
        "Field Name 1",
        "Field Name 2"
    ]
})

Only those field names listed can be used later in the script for things like getCellValues, etc.

This worked like a charm. Thank you!

Fantastic, thank you.