Use node js behind corporate proxy - node.js

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/"

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

Gcloud Postgres wont connect with App Engine

Having a bit of trouble with this. Trying out Google Cloud at the moment and cant my GCloud Postgres db to link to my app engine app.
I'm following everything here :
https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql-postgres
However, when I try to run the createTables.js process I get the following issue:
Failed to create 'visits' table: { Error: connect ECONNREFUSED 127.0.0.1:5432
at Object._errnoException (util.js:1026:11)
at _exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1174:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5432 }
Databases aren't really my strong point so I'm a bit stumped.
These are both running in the same GCloud Project also.
Let me know if you need me to supply any more info (not sure exactly what is useful)
Cheers,
Jay
To establish a connection between Google Cloud Postgres and App Engine, try these steps:
Enable the API
Install the proxy client on your local machine
Decide who will authenticate the proxy
Create a service account, in case your authentication method demands it
Decide how you will specify instances for your proxy
Start the proxy
Update your app and connect it to Googe Cloud Postgres

Error while running node-solr client

guys I am trying to run the example given on github in the following link.
https://github.com/lbdremy/solr-node-client
My port on which Solr runs is 8080.
Any of the files given in the examples directory I run gives the following error
{ [Error: connect ECONNREFUSED]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect' }
Please help me out with this.
check this source code - https://github.com/lbdremy/solr-node-client/blob/master/lib/solr.js
solr uses 8983 port by default
create client with 8080 port, something like......
createClient('127.0.0.1', 8080, '', '/solr')

Resources