Skip to content
Advertisement

Google Cloud Storage bucket->exists gives 403

I am trying to check if a bucket exists in Laravel PHP. I am getting a 403 on the exists() method. Why?

See line 160 https://github.com/googleapis/google-cloud-php/blob/master/Storage/src/Bucket.php

JavaScript

Advertisement

Answer

Your service account does not have the storage.buckets.get permission. In order to check whether a bucket exists and then create it, assign roles/storage.admin to your service account.

For reference, see:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement