写入 Firestore 数据库会导致 Firestore net::ERR_BLOCKED_BY_CLIENT 错误

Pot*_*ion 2 javascript reactjs google-cloud-firestore

我正在尝试写入我的 firestore 数据库,但收到 net::ERR_BLOCKED_BY_CLIENT。我有一个用户保存表单中的信息并将其写入数据库。

这是请求:

// react app

  const referenceDescriptionTextArea = useRef();
  const proposalsCollectionReference = collection(db, "proposals");

  const handleProposalSubmit = async (event) => {
    event.preventDefault();

    var data = {
      author: getCurrentUser().uid,
      timestamp: Timestamp.now(),
      tokenid: tokenid,
      type: "bio",
      description: referenceDescriptionTextArea.current.value,
    };

    addDoc(proposalsCollectionReference, data).then(
      (docRef) => {
        console.log(docRef.id); //saf89hnasHJADH9
        closeModal();
      },
      (err) => {
        console.log(err);
      }
    );
  };
Run Code Online (Sandbox Code Playgroud)

尝试提交提案后控制台错误:

channelrequest.js:1086          POST https://firestore.googleapis.com/google.firestore.v1.Firestore/Write/channel?VER=8&database=projects%2FREDACTED%2Fdatabases%2F(default)&gsessionid=sdaf7uOt-NfCFKX32b-Mw3sJBli_ssdsdfkaNw&SID=Q-mrJ98YFSsadflZRPA&RID=20557&TYPE=terminate&zx=pyjwqxvmw7j9 net::ERR_BLOCKED_BY_CLIENT
Run Code Online (Sandbox Code Playgroud)

我尝试过的一些事情如下:

  1. 仔细检查 firestore 规则以确保其有价值。在这种情况下,我只希望经过身份验证的用户像这样写入文档。错误仍然存​​在。
channelrequest.js:1086          POST https://firestore.googleapis.com/google.firestore.v1.Firestore/Write/channel?VER=8&database=projects%2FREDACTED%2Fdatabases%2F(default)&gsessionid=sdaf7uOt-NfCFKX32b-Mw3sJBli_ssdsdfkaNw&SID=Q-mrJ98YFSsadflZRPA&RID=20557&TYPE=terminate&zx=pyjwqxvmw7j9 net::ERR_BLOCKED_BY_CLIENT
Run Code Online (Sandbox Code Playgroud)
  1. 我确信这是一个 firestore 规则,因此我更改了 firestore 规则以允许任何人写入它(在我的本地部署上)。错误仍然存​​在。
    match /proposals/{proposal} {
        allow read, write: if request.auth != null;
    }
Run Code Online (Sandbox Code Playgroud)
  1. 一些用户表示此错误是由广告拦截程序造成的。为了检查这一点,我打开了一个没有扩展程序的新 Chrome 实例,但得到了相同的结果。我尝试了其他浏览器并遇到了类似的问题。错误仍然存​​在。

Pot*_*ion 5

我发现这是《勇敢传说》中的《勇敢盾》。我做了更多研究,这就是我收集到的内容。

  • Edge、Chrome 和 Firefox:默认情况下我使用 Chrome。Edge 和 Firefox 等其他浏览器通常会提示并自动导入您的设置(这包括书签和扩展程序,并且仅在安装后完成一次)。删除 uBlockOrigin 或 HTTPS Everywehere 等扩展。一旦它们被卸载,我就可以毫无错误地发出请求

  • Brave 浏览器:默认情况下,它将有一个名为 BraveShield 的广告拦截器。单击右上角的图标>禁用。错误现在应该消失了。

在此输入图像描述