Elasticsearch With Node.js throwing an Error: connect EADDRNOTAVAIL - node.js

I am using Elasticsearch6.8.3 docker on an AWS ec2 machine for the production environment. For this purpose, I have installed Elasticsearch via docker-compose. In a microservice architecture many of the other services using different languages like PHP and Python, are just working fine. But When it comes to the Node.js client it starts throwing this error:
Connect EADDRNOTAVAIL IP_ADDRESS:9200 - Local (IP_ADDRESS:0)
at onResponse (/var/app/current/node_modules/#elastic/elasticsearch/lib/Transport.js:228:13)
at ClientRequest.<anonymous>
(/var/app/current/node_modules/#elastic/elasticsearch/lib/Connection.js:113:9)
at ClientRequest.emit (events.js:314:20)
at ClientRequest.EventEmitter.emit (domain.js:483:12)
at Socket.socketErrorListener (_http_client.js:427:9)
at Socket.emit (events.js:314:20)
at Socket.EventEmitter.emit (domain.js:483:12)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
I have also verified the docker container is up and running at that time, as it was accessible through the web browser. I am not sure about the problem that is it a Node client issue or there is something wrong with docker networking? Also right after restarting the docker container, everything started working

Related

read ECONNRESET at TLSWrap.onStreamRead (node:internal/stream_base_commons:211:20)

I Suddenly got the below issue when I tried to run my next js project. it was run perfectly before and this happen without any changes in the system. Any idea regarding this
yarn run v1.22.17
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc.js" https://nextjs.org/docs/messages/swc-disabled
info - Using external babel configuration from /Users/subodha/Subodha/lab/rpm-web/.babelrc.js
postcss-resolve-url: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
node:events:368
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:211:20)
Emitted 'error' event on ClientRequest instance at:
at TLSSocket.socketErrorListener (node:_http_client:447:9)
at TLSSocket.emit (node:events:390:28)
at TLSSocket.emit (node:domain:475:12)
at emitErrorNT (node:internal/streams/destroy:164:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -54,
code: 'ECONNRESET',
syscall: 'read'
}
Node.js v17.2.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
subodha#Subodhas-MacBook-Pro rpm-web %```
I gave the same error.
To solve them, I disabled my VPN connection and built it successfully.
so this error should happen for your network connection.
i got the same error when i was using a vpn or without a vpn.
using another vpn solved this issue.

Timeout OrientDB Error in NodeJS Application

I have developed NodeJS application and using OrientDB database in our project. Everything works fine until we left the application idle for sometime. We are facing time out error in OrientDB.
Please find the error below:
Unhandled rejection OrientDB.ConnectionError [2]: read ETIMEDOUT
at Connection.handleSocketError (/home/myuser/sample_app/node_modules/orientjs/lib/transport/binary/connection.js:352:9)
at Socket.emit (events.js:315:20)
at Socket.EventEmitter.emit (domain.js:485:12)
at emitErrorNT (internal/streams/destroy.js:100:8)
at emitErrorCloseNT (internal/streams/destroy.js:68:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Please advice

Why is my app deployed through App Engine not able to connect to Cloud SQL postgres database?

I attempted to follow the guide here https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql-postgres
to integrate my app with the Cloud SQL postgres instance. However I keep getting an error:
Updating service [default] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Application startup
error:
testpostgres#1.0.0 start /app node app.js
Unhandled rejection SequelizeConnectionError: connect ENOENT
/cloudsql/test-postgress:us-central1:testpostgress/.s.PGSQL.5432 at
connection.connect.err
(/app/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:128:24) at Connection.connectingErrorHandler
(/app/node_modules/pg/lib/client.js:123:14) at emitOne
(events.js:116:13) at Connection.emit (events.js:211:7) at
Socket.reportStreamError
(/app/node_modules/pg/lib/connection.js:71:10) at emitOne
(events.js:116:13) at Socket.emit (events.js:211:7) at emitErrorNT
(internal/streams/destroy.js:64:8) at _combinedTickCallback
(internal/process/next_tick.js:138:11) at process._tickCallback
(internal/process/next_tick.js:180:9)
It must be a problem with my configuration, but I have tried everything I can think of. You can see or clone my project here:
https://github.com/fractalfrenzy/GCS_postgres_test
I know nothing of Node.js, but have a long experience with Java/Python/Go runtime.
Have you opened your CloudSQL instance for connection?
Try this: Configuring IP Connectivity

Unable to use port forwarding with mongoose

I am trying to bind my local port to remote mongo port as remote server is not directly accessible from local. Im trying SSH port binding like this.
ssh -L 27017:localhost:27017 <remote server>
when i try to open mongo shell locally using mongo mongodb://localhost:27017. mongo is connected to remote server but when i do the same from node app using mongoose. i am getting connection error. Can someone suggest system level solution to this problem.
Something broke!!! - MongoError: failed to connect to server [server1:27017] on first connect [MongoError: getaddrinfo ENOTFOUND server1 server1:27017]
at null.<anonymous> (/home/user1/src/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:336:35)
at emitOne (events.js:77:13)
at emit (events.js:169:7)
at null.<anonymous> (/home/user1/src/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:280:12)
at g (events.js:260:16)
at emitTwo (events.js:87:13)
at emit (events.js:172:7)
at Socket.<anonymous> (/home/user1/src/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:187:49)
at Socket.g (events.js:260:16)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at connectErrorNT (net.js:1016:8)
at nextTickCallbackWith2Args (node.js:511:9)
at process._tickCallback (node.js:425:17)

ionic start project connection error (ERRCONNREFUSED)

I have this error when I try to start a new ionic project.
Note:I may have mucked around with proxies at work at some point (behind a proxy), and now it is showing this error at home (direct connection). I'm not sure if this is an issue with proxies for sure though.
The Error:
Creating Ionic app in folder C:\Users\sam\hiya based on tabs project
Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
Error Initializing app: Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:80
Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:80
at ClientRequest.onError (C:\Users\sam\AppData\Roaming\npm\node_modules\ionic\node_modules\request\node_modules\tunnel-agent\index.js:176:17)
at ClientRequest.g (events.js:260:16)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at Socket.socketErrorListener (_http_client.js:267:9)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1253:8)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:80 (CLI v1.7.16)
Your system information:
Cordova CLI: 6.3.0
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
OS:
Node Version: v4.4.5
Your help would be greatly appreciated. Sam
Maybe you can change your default ionicServeAddress on ionic.config file.
On Mac this file is at ~/.ionic. On a PC it can be found at C:/users/username/.ionic. Inside you'll see something like
"ionicServeAddress": "localhost"
Perhaps changing to your proxies ip or localhost might help.

Resources