0
votes

I am getting the following exception

Google_Service_Exception: Error calling POST https://www.googleapis.com/datastore/v1beta2/datasets/smartflowviewer/lookup: (403) Access Not Configured. Google Cloud Datastore API has not been used in project 529103574478 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/datastore/overview?project=529103574478 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

while trying to access the datastore

$service = new Google_Service_Datastore($client);
$service_dataset = $service->datasets;

$path = new Google_Service_Datastore_KeyPathElement();
$path->setKind('auth');
$path->setName($email);
$key = new Google_Service_Datastore_Key();
$key->setPath([$path]);
$lookup_req = new Google_Service_Datastore_LookupRequest();
$lookup_req->setKeys([$key]);

$response = $service_dataset->lookup('smartflowviewer', $lookup_req);

I am using OAuth web client to work with API

$client = new Google_Client();
$client->setClientId($cfg['CLIENT_ID']);
$client->setClientSecret($cfg['CLIENT_SECRET']);
$client->setAccessType('offline');

The project had been working completely fine until yesterday. I have not deployed any new code or changed any setting during the latest month. And suddenly it started throwing this error.

Any ideas of what might be causing this behavior? Thanks a lot.

1

1 Answers

2
votes

The Cloud Datastore v1beta2 API is deprecated, but you can update your code to use the Cloud Datastore v1 API.

One option is to look at the php-gds library.