0
votes

I am trying to get Pub/Sub set up for my Google Account and am running into a snag that doesn't really make much sense.

I have my "Google Cloud Pub/Sub" turned on per this: https://cloud.google.com/pubsub/prereqs

Then, I was able to generate a "service account" with associated JSON credentials file and use it to create an API client with an access token using the "Ruby Google API Client." This all worked fine.

Then, when I try to hit the API to create a new Pub/Sub Topic as follows:

pubsub = client.discovered_api('pubsub', 'v1')

results = client.execute!(
  :api_method => pubsub.projects.topics.create,
  :parameters => { :name => 'projects/myprojectid/topics/gmail-push-notifications') }
)

and I get: "Google::APIClient::ClientError: Not Found" from Google.

Now, I know I am hitting the right API with credentials, because if I omit the step to get an access token then I get a 403 with the same call, and I also know that the format is correct since I get back the following if I mess with the "name" parameter:

"ArgumentError: Parameter 'name' has an invalid value: project/myprojectid/topics/gmail-push-notifications. Must match: /^^projects/[^/]/topics/[^/]$$/."

I have checked my Project ID from the Google Developer console a hundred times to make sure it's correct, and it is, yet it still says not found! Any ideas here?

1

1 Answers

1
votes

This name is invalid: project/myprojectid/topics/gmail-push-notifications

It should be: projects/myprojectid/topics/gmail-push-notifications

The first word is the plural projects, not project.