Categories
Mastering Development

Apollo Server await createConnection (); Error: connect ETIMEDOUT

Hello I have the following error on my apolloserver: Error: connect ETIMEDOUT 172.19.0.2:5432 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16) { errno: ‘ETIMEDOUT’, code: ‘ETIMEDOUT’, syscall: ‘connect’, address: ‘172.19.0.2’, port: 5432 } i’m using the docker compose and then i took the ipv4 from my network and put it on my ormconfig.js my dockercompose version: “3.7” services: […]

Categories
Development

How to handle Redis connection error in Node.js?

const redis = require(“redis”); const session = require(“express-session”); const RedisStore = require(“connect-redis”)(session); const REDIS_HOST = process.env.REDIS_HOST || “localhost” const REDIS_PORT = process.env.REDIS_PORT || 6379 let redisClient = redis.createClient({ host: REDIS_HOST, port: REDIS_PORT }); module.exports = session({ store: new RedisStore({ client: redisClient }), secret: “super-secret-key”, // TBD: grab from env resave: false, saveUninitialized: false, cookie: { […]

Categories
Development

Nuxt.js SSR w/ Nest API deployed to AWS in a Docker container

I’ve tried roughly 5 million variations on the theme here, as well as spent a lot of time poring through the Nuxt docs and I cannot get Nuxt SSR with a Nest backend working when deployed in a docker container to AWS. Below is my current setup. Please let me know if I’ve left anything […]

Categories
Development

NodeJS `net` module slow ECONNREFUSED on Windows

There seems to be a huge performance difference between Linux and Windows when handling errors on the net module of NodeJS. I was handling an ECONNREFUSED error on Windows which seemed to be almost 85 times slower compared to Linux. Take a look at the following scratch file: const net = require(“net”); console.time(“Timing”); const connection […]

Categories
Development

Why is Node AWS DynamoDB ‘putItem’ returning “missing credentials in config” when the correct credentials are in a shared credentials file?

I’m trying to put an item to a DynamoDB table following the AWS example. It works fine when I run the code from the CLI. However, when I try to integrate it into my Node app I get the timeout error below: { “message”: “Missing credentials in config”, “errno”: “ETIMEDOUT”, “code”: “CredentialsError”, “syscall”: “connect”, “address”: […]

Categories
Development

How to “catch” the throw er; // Unhandled ‘error’ event in other people’s APIs code?

I am using a 3rd party package from npm, which in turn connects to some external API on IP address X.X.X.X and it crashes with the following error. The reason is clear, the network was down for a moment, and BOOM my entire program halts: events.js:177 throw er; // Unhandled ‘error’ event ^ Error: connect […]

Categories
Cryptocurrency Development Ethereum

Not able to get deployed address of smart contract

Error: connect ECONNREFUSED /home/sanya/.ethereum/geth.ipc at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1106:14) errno: ‘ECONNREFUSED’, code: ‘ECONNREFUSED’, syscall: ‘connect’, address: ‘/home/sanya/.ethereum/geth.ipc’ } (node:3593) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED /home/sanya/.ethereum/geth.ipc at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1106:14) (node:3593) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which […]

Categories
Cryptocurrency Development Ethereum

Not able to get deployed address of smart contract

Error: connect ECONNREFUSED /home/sanya/.ethereum/geth.ipc at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1106:14) errno: ‘ECONNREFUSED’, code: ‘ECONNREFUSED’, syscall: ‘connect’, address: ‘/home/sanya/.ethereum/geth.ipc’ } (node:3593) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED /home/sanya/.ethereum/geth.ipc at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1106:14) (node:3593) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which […]

Categories
Development

greenlock (lets’encrypt) with express and port forwarding

I am trying to set up letsencrypt (now greenlock apparently) for port forwarding with express. I had this first issue that I solved with: iptables -t nat -A PREROUTING -p tcp –dport 80 -j REDIRECT –to-ports 3000 iptables -t nat -A PREROUTING -p tcp –dport 443 -j REDIRECT –to-ports 3443 The issue is that, now, […]

Categories
Development HTTP

Unsuccessful HTTP request with glitch.me

I am trying to write a proxy to access an api and have some working code that runs without problems on my local machine. Now I’ve tried to host this code on glitch.me, but it results in an ECONNREFUSED error. This only happens on the given domain, not on any other (e.g. www.google.com, www.nytimes.com, etc…). […]