本文介绍了Firebase安全规则:“规则使用旧版本",什么是当前版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

firebase --version 8.4.1

firebase --version 8.4.1

使用Firebase初始化,我创建了一些文件.

with Firebase init I created some files.

现在,firebase部署正在抱怨firebase.storage.错误消息是:

Now firebase deploy is complaining about firebase.storage. The error message is:

这是怎么了?

firebase deploy
deploying database, storage, firestore, functions, hosting
database:   checking rules syntax...
database: rules syntax for database $db is valid
firebase.storage: checking storage.rules for compilation errors...
undefined:undefined - Ruleset uses old version (version
   [1]). Please update to the latest version (version [2]).
firebase.storage: rules file storage.rules compiled successfully

cat storage.rules

service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if request.auth!=null;
    }
  }
}

推荐答案

您应该使用安全规则版本2 即将发布.注意第一行:

You should be using security rules version 2 going forward. Note the first line:

rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if request.auth!=null;
    }
  }
}

这篇关于Firebase安全规则:“规则使用旧版本",什么是当前版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 04:53