Node.js 如何处理目标firestore.googleapis.com的名称解析失败:443代码:14
如何以及在何处处理此错误并阻止我的应用程序崩溃Node.js 如何处理目标firestore.googleapis.com的名称解析失败:443代码:14,node.js,firebase,grpc,firebase-admin,grpc-js,Node.js,Firebase,Grpc,Firebase Admin,Grpc Js,如何以及在何处处理此错误并阻止我的应用程序崩溃 $ 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.callErrorFromStatu
$ 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:当我在没有internet的情况下运行应用程序时,应用程序崩溃。错误堆栈跟踪显示:
Emitted 'error' event on ClientReadableStreamImpl instance at:
这意味着抛出错误是因为流正在发出错误事件,而您没有处理该事件。您可以通过对正在读取的流调用
stream.on('error',callback)
来修复此问题。这是一个DNS错误。DNS是一种用于internet连接的服务。您的应用程序正在尝试访问internet,特别是Firestore,但无法访问。这就是为什么会有错误。这个问题没有简单的解决办法,因为你还必须对应用程序的行为进行编程,才能在脱机时正常运行。关于你的最后一句话,你是说你在没有互联网的情况下运行应用程序时看到了这个错误,还是说你在有互联网的情况下运行应用程序时看到了这个错误,当你在没有互联网的情况下运行应用程序时,你会看到其他错误吗?在有互联网连接的情况下工作正常,在没有互联网的情况下崩溃。