Below is the snippet of nodejs to call wikidata api using request-promise module
var rp = require('request-promise');
var wikidataURL="http://www.wikidata.org/w/api.php?action=wbgetentities&props=labels|claims&languages=en&format=json&ids=Q1"
let promise=rp(wikidataURL).catch(function(e){
console.log(e);
});
For me, it worked normally till 27/1/2020. After that I get a ETIMEDOUT connection error. The same links would work on browser but not on nodejs. There is no proxy involved.
Error message:
{ Error: connect ETIMEDOUT 91.198.174.192:80
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
address: '91.198.174.192',
port: 80 },
Is this something on my side or wikidata server?
So it seems only https is allowed now for wikidata api query after some update from their side
Related
I received this error when I wanted to connect to redis instance created on render.com. It should be mentioned that I enabled the instance to connect servers outside render.com.
Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16) {
errno: -4078,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 6379
}
this is my redis config
import redis from "redis";
const client = redis.createClient({
url: process.env.REDIS_URL_EXTERNAL,
});
export default client;
and this is how I connected the client in the server.js file
(async () => {
await client.connect();
})();
I tried to connect to a Redis instance created on Render.com using the redis library in Node.js. I expected the connection to be successful, and for the Connected to Redis message to be logged to the console. However, I received the mentioned error.
This error is showing up when I am trying to connect nodejs to mongodb atlas. Everything is fine and then it is happening:
Error: queryTxt ETIMEOUT cluster0.1si1c.mongodb.net
at QueryReqWrap.onresolve [as oncomplete] (node:dns:213:19) {
errno: undefined,
code: 'ETIMEOUT',
syscall: 'queryTxt',
hostname: 'cluster0.1si1c.mongodb.net'
}
I'm trying to setup my redis bull on Google Cloud run. Locally everything works.
I use the following code when the server starts:
const client = redis.createClient('6379', '10.103.YYY.YYY');
This seems to be working. I don't receive any error on startup.
When I try to launch a job with Bull like:
const actionQueue = new Bull(uuid(), {
redis: {
port: 6379, host: '10.103.YYY.YYY', tls: {
servername: '10.103.YYY.YYY'
}
}
});
await actionQueue.add();
actionQueue.process(async (job) => {
return this._job();
});
actionQueue.on('completed', async (job, actionId) => {
console.log(`Job completed with result ${actionId}`);
});
actionQueue.on("failed", (job, error) => {
console.log(job.id, error);
});
But the redis is still connecting to localhost ip&port. Anyone an idea why this is still connecting to my localhost? Do I need to setup on different way?
Error log:
2020-11-21T14:55:35.794783Z <rejected> Error: connect ECONNREFUSED 127.0.0.1:6379
Standaard
2020-11-21T14:55:35.794791Z at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1145:16) {
Standaard
2020-11-21T14:55:35.794798Z errno: 'ECONNREFUSED',
Standaard
2020-11-21T14:55:35.794804Z code: 'ECONNREFUSED',
Standaard
2020-11-21T14:55:35.794810Z syscall: 'connect',
Standaard
2020-11-21T14:55:35.794816Z address: '127.0.0.1',
Standaard
2020-11-21T14:55:35.794822Z port: 6379
Standaard
2020-11-21T14:55:35.794828Z }
Standaard
2020-11-21T14:55:35.794834Z}
Standaard
2020-11-21T14:55:35.794987Z The error was: Error: connect ECONNREFUSED 127.0.0.1:6379
Standaard
2020-11-21T14:55:35.794994Z at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1145:16) {
Standaard
2020-11-21T14:55:35.795Z errno: 'ECONNREFUSED',
Standaard
2020-11-21T14:55:35.795006Z code: 'ECONNREFUSED',
Standaard
2020-11-21T14:55:35.795011Z syscall: 'connect',
Standaard
2020-11-21T14:55:35.795017Z address: '127.0.0.1',
Standaard
2020-11-21T14:55:35.795022Z port: 6379
Standaard
2020-11-21T14:55:35.795028Z}
Cloud Run doesn't speak to the VPC natively. You need to bridge Serverless world with out project VPC.
For this, you have to use serverless VPC connector. Create on in the same region as your Cloud Run is deployed.
Then attach it to your Cloud Run service. Like this, the private range (at least, you can also route all the outgoing traffic) traffic is routed to the connector and lands on your VPC. Now you can access to private resources in your VPC like your redis instance.
Unable to connect to the SMTP server. Is there a better way to connect and check the validity of the SMTP server from the domain?
var net = require('net');
const dns = require('dns')
const SMTPConnection = require("nodemailer/lib/smtp-connection");
dns.resolveMx('gmail.com', function(err, addresses){
if(err) console.log(err);
// just taking the first mail server
h = addresses[0].exchange;
options = {
host:h,
port:25,
connectionTimeout: 3000
};
let connection = new SMTPConnection(options);
connection.connect(()=>{console.log('connected')});
connection.on('error', (err)=>{console.log(err)})
connection.on('end', ()=>{console.log('end')})
})
Error
{ Error: connect EHOSTUNREACH 142.250.11.26:25
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
code: 'ESOCKET',
errno: 'EHOSTUNREACH',
syscall: 'connect',
address: '142.250.11.26',
port: 25,
command: 'CONN' }
end
I get the same error when I try with new net.Socket([options]) from the net module
I have one question is when I am hitting a proxy server using axios, I am getting below error, while using npm "request" module it works fine for me.
If anyone can please share thought on this.
Thanks in advance.
Error: getaddrinfo ENOTFOUND http://digitalproxy.gslbext.ngco.com http://digitalproxy.gslbext.ngco.com:80
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
If you are using axios proxy configuration using Node.js URL you have to use hostname instead of href. As I have to connect to different instances with different token settings I make use of axios.create()
const axiosInstance = axios.create()
const url = new URL(env.http_proxy)
const proxyConfig: AxiosProxyConfig = {
host: url.hostname,
port: parseInt(url.port)
}
axiosInstance.defaults.proxy = proxyConfig
return axiosInstance