Search code examples
javascriptreactjsgoogle-cloud-firestore

Writing to Firestore Database Results in Firestore net::ERR_BLOCKED_BY_CLIENT Error


I am trying to write to my firestore database and I get a net::ERR_BLOCKED_BY_CLIENT. I have a user save info from a form and writing it to a database.

Here is the request:

// 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);
      }
    );
  };

Console Error after trying to submit a proposal:

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

Some things I have tried are the following :

  1. Double checked the firestore rules to make sure it is value. In this case I only want authenticated users to write to the doc like so. Error persists.
    match /proposals/{proposal} {
        allow read, write: if request.auth != null;
    }
  1. I was convinced this was a firestore rule so I changed the firestore rule to allow anyone to write to it (on my local deployment). Error persists.
    match /proposals/{proposal} {
        allow read, write: if true; // on local deployment but not working
    }
  1. Some users state this error is due to Adblockers. To check against this I opened up a new instance of Chrome without extensions but I get the same results. I tried other browsers and ran into similar issues. Error persists.

Solution

  • I found out it was Brave Shield on Brave. I did more research and heres what I gathered.

    • Edge, Chrome and Firefox: By default I use chrome. It is typical for other browsers like Edge and Firefox to prompt and auto import your settings (this includes bookmarks and extensions and only done once after install). Remove extensions like uBlockOrigin or HTTPS Everywehere. Once they were uninstalled I was able to make a request without an error

    • Brave Browser: By default it will have an adblocker called BraveShield. At the top right corner, click on the icon>Disable. The Error should now go away.

    enter image description here