5
votes

I am following the below link.

https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/bookshelf-standard/3-binary-data

I create a new Google Cloud Project and followed the above instructions and all fine on the remote server

I tried using an existing old appengine project (created 4-5 years ago). I get the following error at the given code:

"Caller does not have storage.objects.create access to bucket ..."

 storage.create(BlobInfo.newBuilder(bucketName, fileName)
 // Modify access list to allow all users with link to read file
   .setAcl(new ArrayList<>(Arrays.asList(Acl.of(User.ofAllUsers(), 
    Role.READER)))).build(),
 fileStream.openStream());

Following is the stacktrace

  Uncaught exception from servlet
  com.google.cloud.storage.StorageException: Caller does not have storage.objects.create access to bucket asw12.
  at com.google.cloud.storage.spi.v1.HttpStorageRpc.translate(HttpStorageRpc.java:189)
at com.google.cloud.storage.spi.v1.HttpStorageRpc.create(HttpStorageRpc.java:240)
at com.google.cloud.storage.StorageImpl$3.call(StorageImpl.java:151)
at com.google.cloud.storage.StorageImpl$3.call(StorageImpl.java:148)
at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:94)
at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:54)
at com.google.cloud.storage.StorageImpl.create(StorageImpl.java:148)
at com.google.cloud.storage.StorageImpl.create(StorageImpl.java:141)
at com.example.getstarted.util.CloudStorageHelper.uploadFile(CloudStorageHelper.java:65)
at com.example.getstarted.basicactions.CreateBookServlet.doPost(CreateBookServlet.java:70

I checked up the Google Service Accounts in my old project and it exists. How do I know, who is the 'Caller'?

1

1 Answers

5
votes

If you use the google-cloud libraries from App Engine and don't otherwise specify, you will be acting as your project's app engine default service account. Its name is probably something like [email protected].

To get the service account name, open the Service Accounts page in the console, or check the settings on your App Engine page.