Help

Re: Node-fetch ENOTFOUND to API (randomly occurs)

1455 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Jason_Law
5 - Automation Enthusiast
5 - Automation Enthusiast

Using node Airtable calls, when running a the fetch calls, randomly calls will return an error with

FetchError: request to https://api.airtable.com/v0/**************/Popular%20Searches%20Filter/recG77zPA5fNrb05z? failed, reason: getaddrinfo ENOTFOUND api.airtable.com

Doing basic call

base('Card Data').select({
    view: "Selected View",
    pageSize: 3,
}).eachPage(function page(records, fetchNextPage) {
 // code here
 fetchNextPage();
}, function done(err) {
    if (err) { console.error(err); return; }
});
4 Replies 4
Jason_Law
5 - Automation Enthusiast
5 - Automation Enthusiast

Adding a little more context. I believe it is randomly returning the error on the table.find call

base('MOS Card Data').select({
    // Selecting the first 3 records in CMT: Client View:
    view: "Tech: All English MOS",
    pageSize: 3,
    // maxRecords: 1,
}).eachPage(function page(records, fetchNextPage) {

    console.log(records.length)

    records.forEach(function(record) {

        const table = base("Popular Searches Filter");
        const filters = record.get('Popular Searches Filter');
        const mosCode = record.get("mosCode");

        console.log('attempting to write out MOS code: ' + mosCode);
        console.log(filters)

        if (filters !== undefined && filters !== '') {

            filters.forEach((item, index) => {

                table.find(item, (err, rec) => {
        
                    try {
                        if (err) {
                            console.log(`***************** BAD MOS CODE: ${mosCode} **********************`)
                            console.error(err)
                            return
                        }
                        const term = rec.get("Search Term");
                        
                        const output = `${filterMap[term]}\n`;

                        console.log(`${mosCode}`)

                        fs.writeFile(`./mos-filters/${mosCode}.json`, output, { flag: "a+" }, (err) => {
                            if (err) throw err;
                        });

                    } catch (err) {
                        console.log(err)
                        
                    }
                });
        
                
        
            });
        }
        

        

    });

    fetchNextPage();

}, function done(err) {
    if (err) { console.log('**************** bad fetch ******************'); console.error(err); return; }
});
Jason_Law
5 - Automation Enthusiast
5 - Automation Enthusiast

bumping, looking for a possible solution as this is core functionality to the API

I get the same error message.

vasilinabiznyak
4 - Data Explorer
4 - Data Explorer

I am sorry, stuck with the same issue on my node app, could you please advise if you've got a chance to resolve this?