0

Firebase で Google Bigquery をセットアップしようとしていますが、いくつか問題があります。私はgcloud自分のマシン (MacOS Sierra) にインストールし、プロジェクトに composer 経由で Google クラウドをインストールしました。

私のプロジェクトの次のコード:

# 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たが、ブラウザにログインした後もエラーが発生します。どんな助けでも素晴らしいでしょう、ありがとう!

4

1 に答える 1