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
已提問 4 個月前檢視次數 129 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南