意外获得Cloud_firestore/有时会在生产中受到限制

发布于 2025-01-25 08:12:20 字数 947 浏览 3 评论 0原文

我的Firestore规则:

match /app/info {
  allow read;
}

我的代码:

FirebaseFirestore.instance
        .collection('app')
        .doc('info')
        .snapshots()
        .listen(
        (event) {
          final _minVersion = event.data()?['min_version'];
          if (_minVersion is! String) return;
          shouldUpdateApp(Version.parse(_minVersion), context.appLoc);
        },
        onError: (Object error, StackTrace? stackTrace) {
          FirebaseCrashlytics.instance.recordError(
            error,
            stackTrace,
            reason: 'app info onError',
          );
        },
      )

并且正在完美地开发。

但是,有时在生产中,我会收到Firebase Crashlytics报告的错误。

非致命异常:io.flutter.plugins.firebase.crashlytics.fluttererror

[cloud_firestore/dermission-diendied]呼叫者无权执行指定操作。


更新2022年5月18日:

这仅在设备在后台运行时才发生。

My Firestore rule:

match /app/info {
  allow read;
}

My code:

FirebaseFirestore.instance
        .collection('app')
        .doc('info')
        .snapshots()
        .listen(
        (event) {
          final _minVersion = event.data()?['min_version'];
          if (_minVersion is! String) return;
          shouldUpdateApp(Version.parse(_minVersion), context.appLoc);
        },
        onError: (Object error, StackTrace? stackTrace) {
          FirebaseCrashlytics.instance.recordError(
            error,
            stackTrace,
            reason: 'app info onError',
          );
        },
      )

And is working perfectly in development.

However, sometimes in production I get errors reported to Firebase Crashlytics.

Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError

[cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.. Error thrown app info onError.


Update 18 May 2022:

This only happens when the device is 100% running in background.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文