Closed maxNodeJs closed 4 years ago
It seems to be a DNS issue, I'll check what I can do on my side to better handle this kind of error
I also get the same error at random times.
My code is something like this:
/* GET home page. */
app.get('/', recaptcha.middleware.render, (req, res, next) => {
res.render('index', {
....
})
})
{ Error: getaddrinfo EAI_AGAIN www.google.com www.google.com:443
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
errno: 'EAI_AGAIN',
code: 'EAI_AGAIN',
syscall: 'getaddrinfo',
hostname: 'www.google.com',
host: 'www.google.com',
port: '443' }
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:470:11)
at ServerResponse.header (/home/schalk/onemapnginx/node_modules/express/lib/response.js:771:10)
at ServerResponse.send (/home/schalk/onemapnginx/node_modules/express/lib/response.js:170:12)
at done (/home/schalk/onemapnginx/node_modules/express/lib/response.js:1008:10)
at Object.exports.renderFile (/home/schalk/onemapnginx/node_modules/pug/lib/index.js:421:12)
at View.exports.__express [as engine] (/home/schalk/onemapnginx/node_modules/pug/lib/index.js:464:11)
at View.render (/home/schalk/onemapnginx/node_modules/express/lib/view.js:135:8)
at tryRender (/home/schalk/onemapnginx/node_modules/express/lib/application.js:640:10)
at Function.render (/home/schalk/onemapnginx/node_modules/express/lib/application.js:592:3)
at ServerResponse.render (/home/schalk/onemapnginx/node_modules/express/lib/response.js:1012:7)
at app.get (/home/schalk/onemapnginx/routes/index.js:32:7)
at Layer.handle [as handle_request] (/home/schalk/onemapnginx/node_modules/express/lib/router/layer.js:95:5)
at next (/home/schalk/onemapnginx/node_modules/express/lib/router/route.js:137:13)
**at render (/home/schalk/onemapnginx/node_modules/express-recaptcha/dist/v3.js:32:21)**
at Layer.handle [as handle_request] (/home/schalk/onemapnginx/node_modules/express/lib/router/layer.js:95:5)
at next (/home/schalk/onemapnginx/node_modules/express/lib/router/route.js:137:13)
I have same problem middle of sign in if internet connection lose app will crash with this error
I have this problem too. It looks need to handle request.on('error') in addition to res.on('error')
v2.js
request.on('error', function(e) {
cb(e, null);
});
Hey guys, Sorry for the late reply, this has been fixed in the latest release 5.0.2 Thanks for your patience
Not sure but i have two apps running on two separate servers, using express-recaptcha - it all worked well for past two month, and for some reason yesterday both apps on separate server crashed with this error.
Error: getaddrinfo ENOTFOUND www.google.com www.google.com:443 at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26) Emitted 'error' event at: at TLSSocket.socketErrorListener (_http_client.js:395:9) at TLSSocket.emit (events.js:180:13) at emitErrorNT (internal/streams/destroy.js:64:8) at process._tickCallback (internal/process/next_tick.js:178:19)
And today it all went back to normal, I have changed nothing in my code! I wonder if there is a chance that google servers were down / had issues accepting requests and your code doesn't handle this kind of failure, and if not the case, how can I handle this kind of response so the app doesn't crash?
Just as a note! I have used your example to make it work, hence its been working fine for the past two months.
many thanks in advance for your hard work in bringing express-recaptcha to us.