Generating wrong Uri for PubSub Service

296 Views Asked by At

I am using PHP Client API for Google Pub/Sub and have noticed that whenever I am trying to make a request via PubSub service object, it generates the wrong API uri.

E.g. I try to request list of project Topics as follows:

$service = new Google_Service_Pubsub($client);
$topicsList = $service->projects_topics->listProjectsTopics('projects/my-1');

API comes with an error message:

Google_Service_Exception: Error calling GET https://www.googleapis.com/v1beta2/projects/my-1/topics: (404) Not Found

The catch is: the Uri generated is wrong. It should've been https://pubsub.googleapis.com/v1beta2/projects/my-1/topics

Anyone know a workaround for this? I am using the latest API Code from:

github.com/google/google-api-php-client/blob/master/src/Google/Service/Pubsub.php

2

There are 2 best solutions below

0
On BEST ANSWER

It's definitely a bug in google-api-php-client and there is an issue about this: https://github.com/google/google-api-php-client/issues/567

1
On

Below are the code that I'm trying but nothing gonna print.....

$pub_service = new Google_Service_Pubsub($client);

$topicsList = $pub_service->projects_topics->listProjectsTopics('https://pubsub.googleapis.com/v1beta2/projects/qustn-1051');

//$topicsList = $pub_service->projects_topics->listProjectsTopics('projects/qustn-1051'); print_r($topicsList);exit;