how do I handle Name resolution failed for target firestore.googleapis.com:443 code: 14 - node.js

How and where do I handle this error and stop my app from crashing ?
$ node app.js
Server Started at port 3000
events.js:200
throw er; // Unhandled 'error' event
^
Error: 14 UNAVAILABLE: Name resolution failed for target firestore.googleapis.com:443
at Object.callErrorFromStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\call.js:30:26)
at Object.onReceiveStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\client.js:327:49)
at Object.onReceiveStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\client-interceptors.js:303:181)
at Http2CallStream.outputStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\call-stream.js:114:27)
at Http2CallStream.maybeOutputStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\call-stream.js:153:22)
at Http2CallStream.endCall (D:\food_list\node_modules\#grpc\grpc-js\build\src\call-stream.js:140:18)
at Http2CallStream.cancelWithStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\call-stream.js:441:14)
at ChannelImplementation.tryPick (D:\food_list\node_modules\#grpc\grpc-js\build\src\channel.js:214:32)
at ChannelImplementation._startCallStream (D:\food_list\node_modules\#grpc\grpc-js\build\src\channel.js:244:14)
at Http2CallStream.start (D:\food_list\node_modules\#grpc\grpc-js\build\src\call-stream.js:418:22)
Emitted 'error' event on ClientReadableStreamImpl instance at:
at Object.onReceiveStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\client.js:327:28)
at Object.onReceiveStatus (D:\food_list\node_modules\#grpc\grpc-js\build\src\client-interceptors.js:303:181)
[... lines matching original stack trace ...]
at Http2CallStream.start (D:\food_list\node_modules\#grpc\grpc-js\build\src\call-stream.js:418:22)
at BaseStreamingInterceptingCall.start (D:\food_list\node_modules\#grpc\grpc-js\build\src\client-interceptors.js:275:19) { code: 14,
details: 'Name resolution failed for target firestore.googleapis.com:443',
metadata: Metadata { internalRepr: Map {}, options: {} }
}
ps: The app crashes when I run the app without internet.

This is a DNS error. DNS is a service that's used in internet connections. Your app is trying to access the internet, Firestore specifically, but cannot. That's why there's an error. There's no simple fix to this, as you would have to also program behavior for the app to function while offline.

The error stack trace says this:
Emitted 'error' event on ClientReadableStreamImpl instance at:
This means that the error is being thrown because the stream is emitting an error event and you are not handling that event. You can fix that by calling stream.on('error', callback) on the stream that you are reading from.

Related

node:events:371 throw er; // Unhandled 'error' event ^ Error: read EFAULT

I've been getting this error and have tried reinstalling node/vscode already to no avail. This happens maybe 30% of the time after I save my changes in vscode and it ALWAYS crashes my node server.
Nodemon doesn't turn my server back on and it gets really tedious when trying to code. Does anyone have any solutions to this problem?
I'm running on a Macbook Air 2020 with a M1 chip if that makes a difference.
(Using express / nodejs ) node v16.6.0
I've tried killall node, I've tried changing port number. same errors
throw er; // Unhandled 'error' event
^
Error: read EFAULT
at Pipe.onStreamRead (node:internal/stream_base_commons:211:20)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -14,
code: 'EFAULT',
syscall: 'read'
}```

Nexmo webSocket speech-to-text using voiceBase Api

I am trying to convert speech to text using voice base in nexmo. I have faced the issue in WebSocket client.
My response error is:
info: Server listening on:8900
info: A client is connected!
events.js:183
throw er; // Unhandled 'error' event
Error: This socket is closed
at Socket._writeGeneric (net.js:726:18)
at Socket._write (net.js:786:8)
at doWrite (_stream_writable.js:387:12)
at writeOrBuffer (_stream_writable.js:373:5)
at Socket.Writable.write (_stream_writable.js:290:11)
at Socket.write (net.js:704:40)
at WebSocketRequest.accept (/home/apptivo/Music/nexmoVoicebaseSample/Nexmo-RTS-Voicebase-master/WS-node/node_modules/websocket/lib/WebSocketRequest.js:450:21)
at WebSocketServer.handleUpgrade (/home/apptivo/Music/nexmoVoicebaseSample/Nexmo-RTS-Voicebase-master/WS-node/node_modules/websocket/lib/WebSocketServer.js:216:19)
at emitThree (events.js:141:20)
at Server.emit (events.js:217:7)
How to resolved this issue ???
I ran into this issue before (I am the developer of this project). Make sure your api keys are correct and are set in the .env file inside the WS-Node folder. It should be set to
ASR_URL={VOICEBASE_URL}
ASR_CLIENT_KEY={VOICEBASE_CLIENT_KEY}
ASR_CLIENT_SECRET={VOICEBASE_CLIENT_SECRET}

Nodejs server stop with error

My server stops with this error how can i solve it? Or what it is?
events.js:182
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at exports._errnoException (util.js:1024:11)
at TCP.onread (net.js:610:25)
Thanks for answers
"ECONNRESET" means the other side of the TCP conversation abruptly closed its end of the connection. This is most probably due to one or more application protocol errors. You could look at the API server logs to see if it complains about something.
To know more about ECONNRESET, see this answer.
The message Unhandled 'error' event is suggesting that you are not listening for the error event in your code.
You can catch errors like these by catching the error event like the following
connection.on("error", function(err){ // handle "error" event so nodejs will not crash
console.log(err);
});

error message, node project installation on server?

Im trying to start my node project on my node server but I keep getting a error message, the server is ready to use node, I already have some other projects installed on it but this I can't understand. Can anyone understand this error message?
events.js:69
throw arguments[1]; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:850:11)
at Server._listen2 (net.js:995:14)
at listen (net.js:1022:10)
at Server.listen (net.js:1071:5)
at Function.app.listen (/srv/www/ikonset.com/node_modules/express/lib/application.js:531:24)
The error EADDRINUSE means you already have a process bound to the port you're trying to listen on (3000 or whatever). What you should do is first STOP your other process on that port, then restart your Node app.

"Unhandled stream error in pipe" from Node.js

My app: Node.js, Express, some middleware including connect-assets and express.static.
All running on local machine (OSX, Node 0.8) in development mode (thus express.static).
Probably important details: I recently made the whole app work through HTTPS (with redirect from HTTP when necessary) and while developing I use self-signe certificate (enabled in my browser, of course).
Now, the app is often failing wit stack traces like that:
(1)
stream.js:81
throw er; // Unhandled stream error in pipe.
^
Error: write EPIPE
at errnoException (net.js:769:11)
at Object.afterWrite (net.js:593:19)
(2)
stream.js:81
throw er; // Unhandled stream error in pipe.
^
Error: socket hang up
at SecurePair.error (tls.js:948:15)
at EncryptedStream.CryptoStream._done (tls.js:432:17)
at EncryptedStream.CryptoStream._pull (tls.js:577:12)
at SecurePair.cycle (tls.js:866:20)
at EncryptedStream.CryptoStream.end (tls.js:405:13)
at Socket.onend (stream.js:66:10)
at Socket.EventEmitter.emit (events.js:126:20)
at TCP.onread (net.js:417:51)
(3)
stream.js:81
throw er; // Unhandled stream error in pipe.
^
Error: socket hang up
at createHangUpError (http.js:1264:15)
at CleartextStream.socketCloseListener (http.js:1315:23)
at CleartextStream.EventEmitter.emit (events.js:126:20)
at SecurePair.destroy (tls.js:938:22)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
Important: this happens often but not every time, so I assume this not to be a bug in my code.
I found this can be due to express.static and open files limit so I ran ulimit -n 10000 - with no effect, unfortunately.
Any ideas? This starts to be extremely frustrating.
OK, looks like I found the answer (at least I found a similar problem mentioned, tried their fix and it stopped falling):
the express.static middleware must be the last in the chain

Resources