【发布时间】:2017-05-19 00:06:16
【问题描述】:
我正在尝试使用 Firebase 设置 Google Bigquery,但遇到了一些问题。我在我的机器(MacOS Sierra)上安装了gcloud,并在我的项目中通过作曲家安装了谷歌云。
我的项目中的以下代码:
# Includes the autoloader for libraries installed with composer
require __DIR__ . '/vendor/autoload.php';
# Imports the Google Cloud client library
use Google\Cloud\BigQuery\BigQueryClient;
# Your Google Cloud Platform project ID
$projectId = 'hidden here only';
# Instantiates a client
$bigquery = new BigQueryClient([
'projectId' => $projectId
]);
# The name for the new dataset
$datasetName = 'test_dataset';
# Creates the new dataset
$dataset = $bigquery->createDataset($datasetName);
echo 'Dataset ' . $dataset->id() . ' created.';
我要做的只是通过库在 bigquery 中创建一个数据集,但由于以下错误,我无法做到:
Fatal error: Uncaught Google\Cloud\Exception\ServiceException: Could not load the default credentials. Browse to https://developers.google.com/accounts/docs/application-default-credentials for more information in /Applications/MAMP/htdocs/projects/work/bigquery-tests/vendor/google/cloud/src/RequestWrapper.php on line 219
我已尝试按照示例代码的说明运行gcloud beta auth applications-default login,但在登录浏览器后,错误仍然存在。任何帮助都会很棒,谢谢!
【问题讨论】:
标签: php google-bigquery google-cloud-platform google-authentication google-authenticator