这很可能是一种瞬态情况,可以通过回退重试来纠正

Posted

技术标签:

【中文标题】这很可能是一种瞬态情况,可以通过回退重试来纠正【英文标题】:This is a most likely a transient condition and may be corrected by retrying with a backoff 【发布时间】:2021-02-28 16:19:37 【问题描述】:

我在我的项目中使用了 firebase,但我遇到了下面提到的一些问题 -

[cloud_firestore/unavailable] 该服务当前不可用。 这很可能是暂时的情况,可以通过回退重试来纠正。

我正在使用 firebase lib 版本:

 firebase_auth: ^0.18.0+1
 google_sign_in: ^4.5.3
 cloud_firestore: ^0.14.3
 firebase_core: ^0.5.2
 firebase_messaging: ^7.0.3
 firebase_storage: ^4.0.0

flutter run --verbose - 结果:

     [ +208 ms] executing: [/home/loser97/Desktop/application/flutter/flutter_linux/flutter/] git -c
log.showSignature=false log -n 1 --pretty=format:%H
[ +472 ms[        ] f30b7f4db93ee747cd727df747941a28ead25ff5log -n 1 --pretty=format:%H
[   +1 ms] executing: [/home/loser97/Desktop/application/flutter/flutter_linux/flutter/] git tag --points-at HEAD
[+1208 ms] Exit code 0 from: git tag --points-at HEAD
[        ] 1.22.0-12.4.pre
           1.22.1
[  +14 ms] executing: [/home/loser97/Desktop/application/flutter/flutter_linux/flutter/] git rev-parse --abbrev-ref
--symbolic @u
[  +38 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @u
[        ] origin/stable
[        ] executing: [/home/loser97/Desktop/application/flutter/flutter_linux/flutter/] git ls-remote --get-url
origin
[   +9 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +83 ms] executing: [/home/loser97/Desktop/application/flutter/flutter_linux/flutter/] git rev-parse --abbrev-ref
HEAD
[   +6 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[ +157 ms] Artifact Instance of 'androidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'iosEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[  +20 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +162 ms] executing: /home/loser97/Android/Sdk/platform-tools/adb devices -l
[  +52 ms] List of devices attached
[   +3 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[ +158 ms] No supported devices connected.
[  +14 ms] "flutter run" took 502ms.
[  +28 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
           #1      RunCommand.validateCommand (package:flutter_tools/src/commands/run.dart:353:7)
           <asynchronous suspension>
           #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:933:11)
           <asynchronous suspension>
           #3      FlutterCommand.run.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command.dart:836:33)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart)
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:29)
           #6      _rootRun (dart:async/zone.dart:1190:13)
           #7      _CustomZone.run (dart:async/zone.dart:1093:19)
           #8      _runZoned (dart:async/zone.dart:1630:10)
           #9      runZoned (dart:async/zone.dart:1550:10)
           #10     AppContext.run (package:flutter_tools/src/base/context.dart:149:18)
           #11     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:825:20)
           #12     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
           #13     FlutterCommandRunner.runCommand.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command_runner.dart:335:21)
           #14     _rootRunUnary (dart:async/zone.dart:1198:47)
           #15     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #16     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #17     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #18     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #19     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #20     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
           #21     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
           #22     FlutterVersion.checkFlutterVersionFreshness (package:flutter_tools/src/version.dart)
           #23     _rootRunUnary (dart:async/zone.dart:1198:47)
           #24     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #25     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #26     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #27     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #28     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #29     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
           #30     _rootRun (dart:async/zone.dart:1190:13)
           #31     _CustomZone.run (dart:async/zone.dart:1093:19)
           #32     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
           #33     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
           #34     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
           #35     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
           #36     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
           #37     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
           
           
[ +258 ms] ensureAnalyticsSent: 252ms
[   +3 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

请分享你的答案。

【问题讨论】:

请使用 flutter run --verbose 结果编辑您的问题。 欢迎来到 Stack Overflow,Sonu Saini!我建议你阅读“How do I ask a good question”,你应该提供一个minimal reproducible example。有了这个,一些用户可以更好地帮助你。 @Akif 再次检查。 任何更新我也在android中遇到这个问题,我正在使用mac 我也收到了... 【参考方案1】:

在模拟器上:清除模拟器数据然后加载应用。 在手机上:关闭数据然后重新启动手机然后打开数据并加载应用程序

我解决了这个问题

【讨论】:

我在 5 台不同的设备上都遇到了这个问题,我该如何通过重启我的设备来解决它 @Hamza Ali 你试过我的解决方案了吗?如果不起作用,请检查您设备上的互联网连接。【参考方案2】:

这个答案可能已经很晚了,但是谁访问这里是为了这个错误,我没什么要说的,

    如果您使用自己的功能进行操作,请确保将其连接到互联网以进行 firebase 操作。

    如果您的模块与具有离线支持的 firebase 一起使用,请确保您首先缓存了与您的模块相关的集合和所有文档。这样你就可以避免这个错误。如果包括离线模式,显然你可能已经启用了 firebase 的持久性,如果没有,请通过this link。

    如果离线工作及以上无法工作,请务必检查并验证 firebase 中是否存在集合/文档。

    您还可以利用诸如 try...catch... 之类的替代方法进行修复。

    服务器端可能会出现故障,对此我们无能为力。

在大多数情况下,我们可能会出现一些代码问题,您可以通过检查其他 firebase 调用来确认它是否来自服务器端故障。

【讨论】:

【参考方案3】:

如果有人在真实设备上遇到此错误,请至少尝试此解决方案。

确保您已在主 AndroidManifest.xml 文件中启用互联网权限。 .

尝试在 android/app/build.gradle 中将 minifyEnabled 和 shirnkResources 标志设置为 false。

buildTypes 
    release 
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
        shrinkResources false
        minifyEnabled false
    

这对我有用。

我从以下链接获得了帮助,您也可以在此页面上找到此主题的其他解决方案。

https://github.com/FirebaseExtended/flutterfire/discussions/5708#discussioncomment-925997

【讨论】:

【参考方案4】:

如果您使用的是物理设备,请确保它已连接到互联网。

【讨论】:

以上是关于这很可能是一种瞬态情况,可以通过回退重试来纠正的主要内容,如果未能解决你的问题,请参考以下文章

该服务目前不可用 | Firebase cloud_firestore 问题

使用 Kafka 消费者重试来维护订购保证

为啥网上购物订单状态失败,请重试啥原因

MQ 重试队列注意事项

CAD回退重作

Spark性能优化第六季