【发布时间】: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