问题
I'm trying to subscribe to push notifications from Google Classroom using this link and getting the following error. I have created the project, the topic and subscription under the same project and added the service account permissions as noted in the docs.
Right now I'm working on this in the API Explorer on this page.
I can verify that the topic lives under the developer console project.
Are there any other issues that would cause the topic to not be visible in this project?
{
"error": {
"code": 403,
"message": "@TopicNotOwnedByProject The specified Cloud Pub/Sub topic does not belong to your Developer Console project.",
"status": "PERMISSION_DENIED"
}
}
回答1:
After a lot of frustration, I've realized that running the API Explorer will never result in a succesful API call because the API calls are not in my project scope but instead, whatever project the "API Explorer" runs in. This could be resolved if the API Explorer allowed you to select a project to run the sample requests in.
I went ahead and wrote out the code directly and it is working as expected.
来源:https://stackoverflow.com/questions/52562731/pub-sub-topic-not-associated-with-project-error