File Uploaded with predefinedAcl publicRead generating Auth Error
Hi,
I'm uploading files to Google Cloud Storage bucket using Google Cloud PHP SDK:
$object= $this->bucket->upload(
fopen('pdfs/'.$file,'r'),[
'name' => $path.$file,
'predefinedAcl' => 'publicRead'
]
);
After uploading the file, I get back the mediaLink from reponse object. It has been working fine for over a year, however lately I'm encountering an extremely weird issue i.e sometimes the mediaLink works (without auth) and sometimes it doesn't. The files uploaded through the above method starts generating auth errors:
Anonymous caller does not have storage.objects.get access to
xyz.appspot.com/files/abc/def/1536066134246.pdf.
As you can see in the code, the Access Control List scope is Public Read so it should definitely work without auth.
I have not been able to reproduce this issue because it's quite random. Sometimes, this error pops up right after file upload and sometimes file works for random period of time and then starts generating authentication errors.
The bucket is default firebase storage bucket. There is no lifecycle management configuration assigned to the bucket.
@randinterval when you start to receive the error, does it persist on that link indefinitely or is this a temporary issue?
It has been happening since last two months (randomly) and yes, it does persist.
I've been testing this out and haven't been able to reproduce. Could there be any other code which may be inadvertently removing the permissions? Turning on logging might be able to help narrow down what is occurring.