getaddrnfo EAI_AGAIN error on file served over CloudFront

0

Hello,

I have a 10GB file hosted on S3, served via Cloudfront. The file (over CF) is publicly accessible and no WAF has been set up. The file is normally accessed infrequently by a team of less than 100 users. The CF uses a custom domain that is registered with R53 using AWS nameservers and route tables.

I have a simple nodejs program, currently running locally, that checks the file's header for its last modified date every minute. For the most part, it works, and will return a 304 not modified code.

However, if I let it run for a period of time, I will start getting a chain of getaddrinfo EAI_AGAIN errors non stop. It will persist, with maybe 2x 304 success codes every now and then.

I am still able to access the target via my browser despite getting the EAI_AGAIN error.

304 into EAI_AGAIN

I am wondering why I am getting the EAI_AGAIN error. Would it be that, for some reason, either my ISP or CloudFront has been throttling the connection. 1 request every minute seem to be a perfectly reasonable rate of access.

Below is the program I have been using

const https = require('https');
let i = 0;
const checkHeader = () => {
    let date = new Date();
    let url = `${CLOUDFRONT_FILE_URL}`;
    i++;
    https.request(url, {
        method: 'HEAD',
        headers: {
            'If-Modified-Since': date.toString()
        }
    }, (res) => {
        console.log(i, " ", res.statusCode);
    }).on('error', (err) => {
        console.error(i, " ", err);
    }).end();
}
checkHeader();
setInterval(checkHeader, 60 * 1000);
Henry
asked 3 months ago125 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions