小编v7r*_*v7r的帖子

Google App Engine 应用程序无法访问 Google Cloud Storage 存储桶

无法从 Appengine 项目访问默认的 Google Cloud Storage 存储桶。该项目是使用 1.9.0 之前的 App Engine SDK 版本创建的。我已经手动创建了存储桶,根据GCS 文档,默认情况下,Appengine 项目可以访问该存储桶,但在我的情况下无法访问。这是尝试创建文件的代码片段。

...
GcsService gcsService = GcsServiceFactory.createGcsService();
GcsFilename file = new GcsFilename(getGcsDefaultBucketName(), fileName);
GcsFileOptions.Builder builder = new GcsFileOptions.Builder();
GcsFileOptions options = builder.mimeType(mimeType).build();     
GcsOutputChannel channel = gcsService.createOrReplace(file, options); //erroring in this line
...
Run Code Online (Sandbox Code Playgroud)

日志中发现错误:

: com.google.appengine.tools.cloudstorage.NonRetriableException: java.lang.RuntimeException: Server replied with 403, verify ACLs are set correctly on the object and bucket: Request: POST https://storage.googleapis.com/1-ebilly.appspot.com/SERVICESTAGEREPORT-DEVICENAME-LYF2-CREATEDDATE-01012017-CREATEDDATE-19022017-.ZIP
: User-Agent: AppEngine-Java-GCS
: Content-Length: 0
: x-goog-resumable: start
: Content-Type: application/zip …
Run Code Online (Sandbox Code Playgroud)

google-app-engine google-cloud-storage google-cloud-platform

4
推荐指数
1
解决办法
4492
查看次数