There is a table say company. If we try to get the company by it primary key we get the following error.
PLEASE NOTE: This error is not for all instances. It is not repeatedly getting failed. It occurs sometimes but often. 20% of requests are failing
{ Error: getaddrinfo EMFILE dynamodb.eu-west-1.amazonaws.com:443
at Object._errnoException (util.js:1022:11)
at errnoException (dns.js:55:15)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
message: 'getaddrinfo EMFILE dynamodb.eu-west-1.amazonaws.com:443',
code: 'NetworkingError',
errno: 'EMFILE',
syscall: 'getaddrinfo',
hostname: 'dynamodb.eu-west-1.amazonaws.com',
host: 'dynamodb.eu-west-1.amazonaws.com',
port: 443,
region: 'eu-west-1',
retryable: true,
time: 2019-07-18T05:30:09.145Z }
There was a discussion on aws/aws-sdk-js-v3 with issue #3019 where it was recommended to lower the socket timeouts.
This happened to me too when I used the agent as below
new https.Agent({
keepAlive: true,
maxSockets: Infinity,
}
Then I looked more into the documentation here at Reusing Connections with Keep-Alive in Node.js and what I found was an interesting thing
The easiest way to configure SDK for JavaScript to reuse TCP connections is to set the AWS_NODEJS_CONNECTION_REUSE_ENABLED environment variable to 1. This feature was added in the 2.463.0 release.
So, I removed the httpsAgent from the AWS DynamoDBClient connection and added the required environment variable -
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
The error was resolved and things were working as expected.
I hope somebody might find this answer helpful.
Related
I am using memcached locally to store user sessions.
To work with memcached I use the npmjs.com/package/memcached
After upgrading nodes to version v18.7.0, the server stopped connecting to memcached at localhost:11211
However, when the address is changed to 127.0.0.1:11211, the connection proceeds normally, but an error still occurs during further work:
Error: connect ECONNREFUSED ::1:11211
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16) {
[stack]: 'Error: connect ECONNREFUSED ::1:11211\n' +
' at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)',
[message]: 'connect ECONNREFUSED ::1:11211',
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '::1',
port: 11211
}
What could be causing this and how to fix it?
The problem was that memcached was configured to accept connections only via IPv4.
After adding in the settings for receiving connections via IPv6, everything worked.
I'm sending email using nodemailer.
I just follow the sample here.
But I got error like below.
Error: connect ETIMEDOUT 55.28.36.18:587
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) {
errno: -4039,
code: 'ESOCKET',
syscall: 'connect',
address: '55.28.36.18',
port: 587,
command: 'CONN' }
I tried to change port number and other things but can't fix this.
Please tell me what's wrong with my code.
You should check your proxy settings first.
Some of these errors are due to proxy setting.
The sample you followed is working fine on my side.
I'm running Redis on Linux and for a period of time an error occured below in the log:
{ Error: Redis connection to xxx.yyy.zzz.ttt:6379 failed - connect ETIMEDOUT xxx.yyy.zzz.ttt:6379
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
address: 'xxx.yyy.zzz.ttt',
port: 6379 }
I checked username and password, it seems everything goes right with me.
I wanna know roughly:
1) How many reasons will cause this?
2) What suggestions do you have to fix that?
Our Node.js app for facebook messenger platform threw the following error.
We use "request" module to connect to facebook graph api and the module threw this error. And the problem was resolved without doing anything about 1 hour after I found the problem. So now it's working, but I'm afraid when it'll happen again. Could you teach me this problem and if there is any resolution?
{ Error: getaddrinfo EAI_AGAIN graph.facebook.com:443
at Object.exports._errnoException (util.js:949:11)
at errnoException (dns.js:33:15)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:79:26)
code: 'EAI_AGAIN',
errno: 'EAI_AGAIN',
syscall: 'getaddrinfo',
hostname: 'graph.facebook.com',
host: 'graph.facebook.com',
port: 443 }
Short answer:
This happens when you have lost connection to your DNS server or the DNS settings are wrong (this includes, but is not limited to, complete or partial disconnect from internet).
That is: Please check if your cable or WiFi connection OR your internet provider does not have a (temporary) problem.
Details:
When this happened, I could see in the debugger call stack that the system function getaddrinfo fails. Thus, it seemed like the trivial reason was - the system cannot map the host name to an IP (in your case the host name 'graph.facebook.com" could not be found).
Indeed, when I tried to ping the host name, which I wanted to reach I got the same as ping error like pinging an unknown host:
u#h:~$ ping someunknownhost.xyzdomain
ping: unknown host someunknownhost.xyzdomain
Additionally when, my connectivity to internet recovered and I could ping the host then the problem of node.js also disappeared.
I have a sails web app in an intranet environment. An average of ~12 users are logged in at the same time. Eventually I get the classic connection refused message from sails-postgresql that lasts for at least 3 minutes, denying all http requests made to the app.
Error creating a connection to Postgresql using the following settings:
{
...
schema: true,
ssl: false,
adapter: 'sails-postgresql',
poolSize: 50
...
}
I either get { [Error: write ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'write' } or { [Error: write ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }.
My PostgreSQL logs the following message:
No connection could be made because the target machine actively refused it.
As you can see, my poolSize in sails.config.connections is set to 50 and my max_connections in postgresql.conf is set to 100. I'm not using this database for something else.
Is my poolsize set ok? Is it a problem from Sails or is it Postgres'?
Try increasing max_connections in postgres config file postgresql.conf, in my Ubuntu 15.04 linux it is located in this path:
/etc/postgresql/9.4/main/postgresql.conf