cloud functions EAI_AGAIN error

447 views
Skip to first unread message

Naser Samara

unread,
Jun 18, 2021, 5:01:22 AM6/18/21
to Firebase Google Group
Hi

I get the down attached  error sometimes when I make a http request from my cloud function using node https.
I have Blaze plan

why I get this error?

"errno":"EAI_AGAIN","code":"EAI_AGAIN","syscall":"getaddrinfo","hostname":"pci.rivhit.co.il","host":"pci.rivhit.co.il","port":443



 const https = require('https');
 const icreditPostData = createPostData(null,taskOptions)
 console.log("icreditPostData :" + icreditPostData)
 const icreditOptions = createOptions({ENV:taskOptions.ENV,method:"ChargeSimple/Full"}, Buffer.byteLength(icreditPostData));
        console.log("icreditOptions: " + JSON.stringify(icreditOptions))
        const req = https.request(icreditOptions, (res) => {
            console.info('statusCode:', res.statusCode);
            console.info('headers:', JSON.stringify(res.headers));
            res.setEncoding('utf8');
            res.on('data', (data:any) => {
                console.info(data);
                const parsedData = JSON.parse(data)
                if(parsedData.Status === 0){
                    resolve("finalChargeSuccess")
                }
                else{
                    reject("finalChargeFail")
                    // response.send(parsedData.ErrorMessage)
                }
            });
        });
        req.on('error', (e) => {
            console.error("myErr" + JSON.stringify(e));
            // response.send(e);
            reject(e);
        });
        req.write(icreditPostData);
        req.end();

Reply all
Reply to author
Forward
0 new messages