【问题标题】:Can't create bucket with domain using API but allowed in console无法使用 API 创建带域的存储桶,但在控制台中允许
【发布时间】:2017-06-29 07:12:26
【问题描述】:

错误

Fatal error: Uncaught exception 'Google\Cloud\Exception\ServiceException' with message 

{ 
    "error": { 
        "errors": [ 
            { 
                "domain": "global",
                 "reason": "forbidden", 
                 "message": "The bucket you tried to create is a domain name owned by another user." 
            } 
        ], 
        "code": 403, 
        "message": "The bucket you tried to create is a domain name owned by another user." 
    } 
}

当我尝试使用 API 创建带有域的存储桶时出现此错误。但是,我可以在控制台的仪表板可视界面中创建相同的存储桶。

有谁知道为什么会发生这种情况?网站管理员验证工具,域被列为已验证。

putenv('GOOGLE_APPLICATION_CREDENTIALS=../../service-account.json');

# Your Google Cloud Platform project ID
$projectId = 'PROJECT';

# Instantiates a client
$storage = new StorageClient([
    'projectId' => $projectId
]);

# The name for the new bucket
$bucketName = 'somethingsomething123.domain.co';

# Creates the new bucket
$bucket = $storage->createBucket($bucketName); 

echo 'Bucket ' . $bucket->name() . ' created.';

【问题讨论】:

    标签: php google-app-engine google-cloud-storage


    【解决方案1】:

    我必须转到以下 URL 并添加我的服务帐户。

    https://www.google.com/webmasters/verification/details?hl=en&domain=[YOUR-DOMAIN.COM]
    

    【讨论】:

      猜你喜欢
      • 2020-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-06
      • 1970-01-01
      • 1970-01-01
      • 2020-04-27
      • 2021-11-15
      相关资源
      最近更新 更多