1
votes

I am trying to serve a React app from Google Cloud Storage. I built the React project and uploaded the contents of the build/ directory to Google Cloud Storage. I made sure every file inside is publicly accessible. However when I go to my Google Cloud bucket link http://storage.googleapis.com/BUCKET_NAME/, I get some XML about a permission error:

Then, I tried to navigate to the URL http://storage.googleapis.com/BUCKET_NAME/index.html, which brings up a blank page

1
What's the name pattern of your bucket?guillaume blaquiere
www.mywebname.meJOSE ROLANDO HEREDIA EGUIAZU
Can you add in you question the result of this command gsutil web get gs://www.mywebname.me?guillaume blaquiere

1 Answers

1
votes

First of all, I'd definitely suggest using firebase hosting, instead if cloud storage, it's made for hosting static websites, and I've used it with a react app and it's working quite fine for me.

It'd be helpful if you can share the error message you received.

You can try the following (Not sure it'll work, given that you haven't provided the error message, but it's worth a shot)

You can try editing the rules, to disable authentication for browsing the files in that bucket.

In your firebase console, go to Storage , choose you bucket, Rules tab, Edit Rules

you can try to change from

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

to

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