I know this is a widely discussed issue since 2016, but I haven't been able to fix the problem. For a Google Cloud project my personal account and a service account (the one I get with the command gcloud auth list) are both Owner.
A python3 code which use the google-cloud package (storage module) works fine on my laptop using my personal account, i.e. the file uploading works correctly.
Instead, on a compute engine, I get the following error:
File "/home/user/git/project/GoogleUtils/StorageUtils.py", line 109, in upload_blob
blob.upload_from_filename(source_file_name)
File "/home/analysis/.local/lib/python3.5/site-packages/google/cloud/storage/blob.py", line 992, in upload_from_filename
size=total_bytes)
File "/home/analysis/.local/lib/python3.5/site-packages/google/cloud/storage/blob.py", line 949, in upload_from_file
_raise_from_invalid_response(exc)
File "/home/analysis/.local/lib/python3.5/site-packages/google/cloud/storage/blob.py", line 1735, in _raise_from_invalid_response
raise exceptions.from_http_response(error.response)
google.api_core.exceptions.Forbidden: 403 POST https://www.googleapis.com/upload/storage/v1/b/bucket_name/o?uploadType=multipart: Insufficient Permission
This happens with both my personal account and the service account. I suppose that it's not a permission problem... So where I should look for? The weird part is that the file downloading works perfectly.