我正在使用firebase serve在我的计算机上托管一个firebase项目。当我的网络中断时,我得到下面的错误,程序退出。是否有启用自动重新连接的--option,或者以某种方式手动捕获错误并重新连接?我希望应用程序继续尝试连接,直到我的互联网恢复在线。
> throw er; // Unhandled 'error' event
> ^
>
> Error: 14 UNAVAILABLE: Name resolution failed for target dns:firestore.googleapis.com:443
> at Object.callErrorFromStatus (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\call.js:30:26)
> at Object.onReceiveStatus (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\client.js:328:49)
> at Object.onReceiveStatus (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:304:181)
> at Http2CallStream.outputStatus (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\call-stream.js:116:74)
> at Http2CallStream.maybeOutputStatus (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\call-stream.js:155:22)
> at Http2CallStream.endCall (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\call-stream.js:141:18)
> at Http2CallStream.cancelWithStatus (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\call-stream.js:450:14)
> at ChannelImplementation.tryPick (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\channel.js:237:32)
> at ChannelImplementation._startCallStream (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\channel.js:267:14)
> at Http2CallStream.start (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\call-stream.js:428:22)
> Emitted 'error' event on ClientReadableStreamImpl instance at:
> at Object.onReceiveStatus (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\client.js:328:28)
> at Object.onReceiveStatus (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:304:181)
> [... lines matching original stack trace ...]
> at Http2CallStream.start (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\call-stream.js:428:22)
> at BaseStreamingInterceptingCall.start (C:\Users\Tower\IdeaProjects\team-up-server\functions\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:276:1
9) {
> code: 14,
> details: 'Name resolution failed for target dns:firestore.googleapis.com:443',
> metadata: Metadata { internalRepr: Map {}, options: {} }
> }发布于 2020-09-06 08:01:04
firebase serve已弃用。
试试firebase emulators:start;我在使用它时没有遇到任何开/关/在线问题。
文档:https://firebase.google.com/docs/rules/emulator-setup
但是,请注意,错误消息中的错误与您正在进行的Google API调用有关。
如果你正在调用一个在线API而不是一个模拟的API,你的应用本身需要能够被设置为重试或处理失败的调用。
firebase的某些方面确实可以在本地模拟;同样,请参阅上面链接的文档。
https://stackoverflow.com/questions/63759431
复制相似问题