Santosh Mainali
Santosh Mainali

Reputation: 225

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

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.

Upvotes: 1

Views: 6423

Answers (2)

user3670473
user3670473

Reputation: 351

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.

Upvotes: 1

murgatroid99
murgatroid99

Reputation: 20297

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.

Upvotes: 0

Related Questions