I keep getting the following error:
? Upload Failed. An exception occurred:
{ “error”: { “code”: 403, “message”:(PII Removed by Staff) @account5.iam.gserviceaccount.com does not have storage.objects.create access to the Google Cloud Storage object. Permission ‘storage.objects.create’ denied on resource (or it may not exist).", “errors”: [ { “message”: “<can’t post url here as forum gives error> does not have storage.objects.create access to the Google Cloud Storage object. Permission ‘storage.objects.create’ denied on resource (or it may not exist).”, “domain”: “global”, “reason”: “forbidden” } ] } }
I’ve tried adding storage.objects.create but there is no such Role when adding. Then I see that the Roles you choose has various options under it. The one with storage.objects.create is Storage Object User. Link: Cloud Storage roles and permissions | Identity and Access Management (IAM) | Google Cloud
Even after adding that Role, I still get the error. Other Roles added (most in frustration) are Environment and Storage Object Administrator, Environment and Storage Object User, Storage Admin, Storage Object Creator.
What is needed to save a file to GCS using the API?
I’m using the SDK:
require '../vendor/autoload.php';
use Google\Cloud\Storage\StorageClient;
The code works on test localhost account