laravel-google-cloud-storage icon indicating copy to clipboard operation
laravel-google-cloud-storage copied to clipboard

File is not uploaded to bucket, read is possible

Open gcjbr opened this issue 3 years ago • 5 comments

Discussed in https://github.com/spatie/laravel-google-cloud-storage/discussions/29

Originally posted by souljacker June 24, 2022 I'm running Laravel 9, and just installed the package.

In my ENV I'm using these vars with the correct data GOOGLE_CLOUD_STORAGE_BUCKET= GOOGLE_CLOUD_KEY_FILE= FILESYSTEM_DISK=gcs

I can confirm it works because I manually updated a jpeg to the bucket and this returns true: Storage::exists('teste.jpeg');

If I try for any other filename it returns false, so it's actually reading the bucket.

Trying to write to the bucket, though, won't work nor return any errors.

This, does nothing:

Storage::put('teste.txt', 'asdasdadasddaasd');

I gave admin access to my service account, so I don't think it's permissions.

Any ideas?

gcjbr avatar Jun 24 '22 17:06 gcjbr

I'm also having this issue, my guess it it's a permissions issue somewhere and not the library, but it's frustrating

peterfox avatar Jun 24 '22 22:06 peterfox

I'm also having this issue, my guess it it's a permissions issue somewhere and not the library, but it's frustrating

I wouldn't think so. I tried with an Owner of the project role and also as Storage Admin role.

Both have read access but won't write. The more frustrating is there's no error message at all

gcjbr avatar Jun 24 '22 22:06 gcjbr

Ok, solved it by changing 'visibility' to

'visibility' => PortableVisibilityHandler::NO_PREDEFINED_VISIBILITY,

in filesystems.php config file.

gcjbr avatar Jun 24 '22 22:06 gcjbr

Can confirm, fixed the problem for me.

peterfox avatar Jun 24 '22 23:06 peterfox

Thanks @souljacker

ansezz avatar Jul 06 '22 09:07 ansezz

Thanks @souljacker for the solution 🥳 this was driving me crazy.

TimoKoerber avatar Mar 17 '23 09:03 TimoKoerber

Thanks @souljacker it worked for me too...

makinita avatar Mar 24 '23 14:03 makinita

Reading through this, I don't think we need to make any changes to the code.

Feel free to send a PR to the readme to make it more clear.

freekmurze avatar Mar 27 '23 06:03 freekmurze