NodeJs EHOSTUNREACH in Express - node.js

I am facing problem on server while calling external API on HTTPS. I am checking with HTTPS. On Local its working fine without any issue
Here is my error
Error: connect EHOSTUNREACH 54.147.133.143:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno: 'EHOSTUNREACH',
code: 'EHOSTUNREACH',
syscall: 'connect',
address: '54.147.133.143',
port: 443
}
if i hit the curl request on server directly and its working fine.
curl -H "Authorization: Bearer mytoken"
https://api.example.com/v3/a/accountid/companies.json
Any idea what could be the issue

Related

Memcached refuse connection after node upgrade to v18.7.0

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.

Error: connect ETIMEDOUT 55.28.36.18:587 at TCPConnectWrap

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.

Cpanel Email not sending on live site

I have a cpanel email that can send mails with a nodejs application. However this only works locally. When I try on the live site, I get this error:
Error: connect ECONNREFUSED
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) {
errno: 'ECONNREFUSED',
code: 'ESOCKET',
syscall: 'connect',
port: 465,
command: 'CONN'
}
I heard it's a firewall issue. If it is, how can I enable port 465 in my cpanel. Or how can I change to a different port? Please graphical solutions would be applicated

Node mailer gives the rest mail ECONNREFUSED error in server after sending 6 successfull mail always

I am facing a problem related node mailing service. I am trying to send mail by node mailer in windows server. Out 15 mail or 12 mail it always send first 6 mail success fully.For the rest mail i am getting connection refused error.
Node version: 10.16.0
Node mailer version:^4.4.2
{ Error: connect ECONNREFUSED 198.57.247.139:465
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)
errno: 'ECONNREFUSED',
code: 'ECONNECTION',
syscall: 'connect',
address: '198.57.247.139',
port: 465,
command: 'CONN' }
I dont understand what is the problem here. It is not happening in my local environment.
If you can give me an idea it will be very help full.
Thank you

Use node js behind corporate proxy

I am trying to connect to a Firebase db from behind a corporate proxy.
Getting below error
error: { Error: connect ECONNREFUSED 35.201.97.85:443
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '35.201.97.85',
port: 443 }
statusCode: undefined
body: undefined
It works perfectly if I connect to my personal hotspot. Any way to make it work on corporate network.
You need to set proxy inside the .npmrc file
for Windows
1. Go to C:/Users/Username
2. Create or find .npmrc file
3. Add proxy entry inside the file
for linux
Execute following command to find .npmrc file and add the proxy entry inside it. Use following command to list the file:
npm config ls -l | grep config
or you can try following command:
npm config set proxy "http://domain\username:password#servername:port/"
or
npm config set proxy "http://domain%5Cusername:password#servername:port/"

Resources