Help

Re: Error: network timeout on update

Solved
Jump to Solution
1423 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Max
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello everyone,

I’ve got this error Error: network timeout at: https://api.airtable.com/v2/bases/appOZnMxRdfPA9ddR/tables/tbledHinNmtQRT4lb/records/update

But this weird thing is that the update works. But still, i have this error.

tableSociete.updateRecordsAsync([{
    id: societe.id,
    fields: {
        "refreshtoken": responseJson.refresh_token,
        "accesstoken": responseJson.access_token
    },
}])

The other weird thing is that i dont have the error everytime but just with some “societe.id”

1 Solution

Accepted Solutions
Chris_Parker
6 - Interface Innovator
6 - Interface Innovator

I learned one thing from support helped and it was to specifically not include the fields in selectRecordsAsync.

let allRecords = await table.selectRecordsAsync({fields: []});

See Solution in Thread

6 Replies 6
Chris_Parker
6 - Interface Innovator
6 - Interface Innovator

This is happening to me as well. It’s a performance issue in their Automation platform. I was going to come here to ask if it is possible to throttle the throughput. I’d rather have an automation that completes reliably but is slower than one that times out constantly.

Max
5 - Automation Enthusiast
5 - Automation Enthusiast

It is problematic, i’m flooded by errors even if it works…

Chris_Parker
6 - Interface Innovator
6 - Interface Innovator

I learned one thing from support helped and it was to specifically not include the fields in selectRecordsAsync.

let allRecords = await table.selectRecordsAsync({fields: []});
Max
5 - Automation Enthusiast
5 - Automation Enthusiast

Thank you Chris for the ping.

pdxbug
5 - Automation Enthusiast
5 - Automation Enthusiast

We have a fairly large base and a few automations that do a lot of things (record matching to de-dupe, creation of secondary records, field sanitization). For the past year we had this all in a single Run Script that would work on Form Submission. Recently our number of records in the main table went over 30K and we started to get these Network Timeouts. Working with Airtable Support, they suggested:
1. removing unnecessary records from the query via Views, Filters, or record deletion for the Query
2. moving each query, update, delete command into it's own Run Script for simple 're-run' of the automation. 
3. add try/catch to any base touches in the Run Script
4. use the native airtable functions where possible instead of the Run Script (apparently the built in functions have a retry option on failure, whereas the Run Script you need to add your own Try/Catch retry (which I'll show below)

try/catch: (also added a delay and output options for email notification of errors)

const {
    budgetTable,
    primaryField,
    thisAirtableId,

    //I put these in the input variables for easy updates and testing
    maxTries, //3
    delay, //1000    - in ms
    debug, //false to run, true to debug

} = input.config();
const maxTriesInt = parseInt(maxTries); //can't use >= with strings
const delayInt = parseInt(delay);

let errorDetected = '';

//trying a new sleep function to put in a slight delay on retry
//just a short delay to try and allow the network to clear
function sleep(milliseconds) {
    var start = new Date().getTime();
    for (var i = 0; i < 1e7; i++) {
        if ((new Date().getTime() - start) > milliseconds){
        break;
        }
    }
}

const slugTable = base.getTable(budgetTable);//Budget
const slugDailyView = slugTable.getView('Created in last day'); //filter down to the minimum required records to search
let count = 0;
while(true) {
    try {
        let existingRecords = await slugDailyView.selectRecordsAsync({ fields: [primaryField] });
        let mapOfUniqueIdToExistingRecordId = createMappingOfUniqueFieldToRecordId(existingRecords.records, primaryField);
        // break out of loop, or return, on success

        //I want the retrieved information to be pushed to another Run Script further down in the automation
        output.set('existingRecordsJSON', JSON.stringify(existingRecords));

        //I want to push the debug, error detection information for other scripts and for email notification later
        output.set('debug', debug);
        output.set('maxTries', maxTries);
        output.set('delay', delay);
        output.set('errorDetected', errorDetected);

        //if you don't want to exit the script and continue past the try/catch, remove the break;
        break;
    } catch (e) {
        // handle exception
        if (count >= maxTriesInt) {
            console.error(`Max retries (${maxTriesInt}) exhausted, final error thrown:`);
            throw e;
        } else {
            var d = new Date();
            var n = d.toLocaleTimeString('en-US', {timeZone: "America/Chicago"}); //without the timezone, it will show UTC
            console.log(n);
            console.error(`Error during attempt #${count}:`);
            console.error(`Name: `+e.name);
            console.error(`Message: `+e.message);
            errorDetected = thisAirtableId;
            sleep(delayInt);
            count++;
        }
    }
}
pdxbug
5 - Automation Enthusiast
5 - Automation Enthusiast

UPDATE:
A follow up on my above comment. They try/catch is not working as expected. Since I can't see what's going on in the back end, my guess is that a connection is being made, failing and the try/retry is not working because it is using the same connection. I've exhausted the 30 second max time limit of the automation attempting to 'try again later' with various attempts and delays. (1 second delays 20 times, 1.5 second delays 10 times). The delay and the retry is not working to solve this issue.