3


我在 Google App Engine 上运行一个 MapReduce 作业,其配置类似于:

MapReduceSettings.Builder()
            .setBucketName("my-bucket")
            .setWorkerQueueName(QUEUE_NAME)
            .setModule(MODULE)
            .build();

该存储桶由 App Engine 本身用于临时数据。


问题是,当我运行作业时,它会失败并显示以下堆栈跟踪:

com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
java.lang.RuntimeException: Writeable Bucket 'my-bucket' test failed. See http://developers.google.com/appengine/docs/java/googlecloudstorageclient/activate for more information on how to setup Google Cloude storage.
    at com.google.appengine.tools.mapreduce.MapReduceSettings.verifyAndSetBucketName(MapReduceSettings.java:134)
    at com.google.appengine.tools.mapreduce.MapReduceSettings.<init>(MapReduceSettings.java:89)
at com.google.appengine.tools.mapreduce.MapReduceSettings.<init>(MapReduceSettings.java:31)
    at com.google.appengine.tools.mapreduce.MapReduceSettings$Builder.build(MapReduceSettings.java:83)
    at
    ...
    ...
Caused by: com.google.appengine.tools.cloudstorage.NonRetriableException: java.lang.RuntimeException: Server replied with 403, verify ACLs are set correctly on the object and bucket: Request: DELETE https://storage.googleapis.com/my-bucket/2f249469-c77a-4540-bbbd-45fcd27d7600.tmp
User-Agent: App Engine GCS Client

no content

Response: 403 with 111 bytes of content
Content-Type: application/xml; charset=UTF-8
Content-Length: 111
Vary: Origin
Date: Tue, 12 Aug 2014 18:20:20 GMT
Expires: Tue, 12 Aug 2014 18:20:20 GMT
Cache-Control: private, max-age=0
Server: UploadServer ("Built on Jul 31 2014 18:25:34 (1406856334)")
Alternate-Protocol: 443:quic
X-Google-Cache-Control: remote-fetch
Via: HTTP/1.1 GWA
<?xml version='1.0' encoding='UTF-8'?><Error><Code>AccessDenied</Code><Message>Access denied.</Message></Error>

我已经尝试将服务帐户名称(name-of-my-app@appspot.gserviceaccount.com) 添加为团队成员,但在用户旁边它一直在说

邀请已发送。等待答复。

如何将服务帐户添加到开发人员列表中,以便我可以授予它访问我的存储桶的权限?

谢谢

4

1 回答 1

2

我使用 gsutils 命令行工具解决了它:

gsutil acl ch -u name-of-my-app@appspot.gserviceaccount.com:WRITE gs://my-bucket

根据 Google Storage 文档,有时无法将服务帐户添加到开发者列表中,即使他们没有说明原因

注意:在某些情况下,您可能无法将服务帐户添加为团队成员。如果您无法添加服务帐户,请使用替代方法,即存储桶 ACL,如下所述。

于 2014-08-12T23:07:40.757 回答