Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

GCS public url returns a WIERD error

Hello, 

We have different GCP projects representing different environments (for simplicity, please consider we have dev & stg environments)

However, when accessing a url of two different "public" buckets (the stg one and dev one) like below, we get two "completely different" responses.

https://storage.googleapis.com/<stg's bucket name>/<one of the folders' name>/

https://storage.googleapis.com/<dev's bucket name>/<one of the folders' name>/

 

One gets a 200 and the other gets 404 with NoSuchKey error (No such object)

What could be the reason behind this? I'd. appreciate your help

 

Preconditions:

- Both buckets are set public

- Both buckets' folders and objects structure is identical

- Both buckets dont' have the "hosting static website" setting.

 

2 1 645
1 REPLY 1

Hi @TakashiIde,

Welcome to Google Cloud Community!

Please check if you copy the object from one bucket to another. Doing so the object being transferred to another bucket will create a new metadata for that object. Even though it is the same object with the same file type and the same size, it's still a different file due to object metadata. You can check this documentation through this link. In addition, Cloud Storage doesn't recognize directories or folders, all objects are flat namespace and "folders" are part of the object's name.

I would suggest deleting the old bucket and creating a new one to prevent similar or related errors and upload the object, making sure that the pathname is correct.

If the aforementioned steps didn't work, you may file a bug through this link so that our engineers could take a look at this. We don't have a specific ETA but you can keep track of its progress once the ticket has been created. 

Hope this helps.