Raj*_*esh 5 google-app-engine google-cloud-storage
我正在关注以下链接。
我创建了一个新的 Google Cloud 项目并按照上述说明在远程服务器上一切正常
我尝试使用现有的旧 appengine 项目(创建于 4-5 年前)。我在给定的代码中收到以下错误:
“调用者没有 storage.objects.create 访问存储桶......”
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());
Run Code Online (Sandbox Code Playgroud)
以下是堆栈跟踪
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
Run Code Online (Sandbox Code Playgroud)
我检查了旧项目中的 Google 服务帐户,它存在。我怎么知道,谁是“来电者”?
如果您使用 App Engine 中的 google-cloud 库并且没有另外指定,您将充当项目的应用引擎默认服务帐户。它的名称可能类似于 your-project-id@appspot.gserviceaccount.com。
要获取服务帐户名称,请在控制台中打开服务帐户页面,或检查App Engine页面上的设置。
| 归档时间: |
|
| 查看次数: |
5320 次 |
| 最近记录: |