GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Trying to subcribe pubsub topic but not getting anything · Issue #679 · googleapis/google-cloud-node

Trying to subcribe pubsub topic but not getting anything #679

New issue
Copy link
New issue
Copy link
Closed
Closed
Trying to subcribe pubsub topic but not getting anything#679
Copy link
Assignees
jgeewax
Labels
api: pubsubIssues related to the Pub/Sub API.type: questionRequest for information or clarification. Not an issue.

Description

@AP25
AP25
opened on Jun 19, 2015
Issue body actions

Hi,

I am trying to subscribe created topic on pubsub for that i am using

var gcloud = require('gcloud');
var pubsub1 = gcloud.pubsub({
    projectId: 'ProjectID',
    keyFilename: KeyFile(Buffer format)
});
pubsub1.createTopic('topicName', function(err, topic) {
});
var _topicCreated = pubsub1.topic('topicName')
 _topicCreated.subscribe('newSubscription', function(err, subscription) {
 }); 

But using this i am not getting callback of subscription. Is anything missing in this request?

Thanks in advance!!!

Activity

Next
  1. jgeewax commented on Jun 19, 2015

    @jgeewax
    jgeewax
    on Jun 19, 2015
    Contributor
    More actions

    What exactly is going on in keyFilename: KeyFile(Buffer format) ? keyFilename should be a path to a .json file you get via the Cloud Console (see http://googlecloudplatform.github.io/gcloud-node/#/authorization for more on that).

    Can you also clarify what you mean by "not getting callback of subscription"? You mean the callback is not being executed? Did you try adding console.log(err) inside each of the callbacks to see what's happening?

  2. jgeewax
    added
    type: questionRequest for information or clarification. Not an issue.
    api: pubsubIssues related to the Pub/Sub API.
    on Jun 19, 2015
  3. jgeewax commented on Jun 19, 2015

    @jgeewax
    jgeewax
    on Jun 19, 2015
    Contributor
    More actions

    Also -- this might be better asked over on StackOverflow unless it looks like a bug with gcloud.pubsub.

  4. AP25 commented on Jun 19, 2015

    @AP25
    AP25
    on Jun 19, 2015
    Author
    More actions

    Hi jgeewax,

    Yes i am using keyFilename as .json file of cloud console.I am not getting callback of subscription means i added console.log(err) and console.log(subscription).But i didn't get any error or subscription log.
    Same thing happened while creating topic.I didn't get error log also.
    So is that topic is created? and how can i subscribe to that topic ?

  5. jgeewax commented on Jun 19, 2015

    @jgeewax
    jgeewax
    on Jun 19, 2015
    Contributor
    More actions

    You're saying that the callback isn't getting executed at all?

    As in, running the following prints out nothing?

    var gcloud = require('gcloud');
    var pubsub = gcloud.pubsub({
        projectId: 'purple-spaceship-123', // or whatever your project ID is.
        keyFilename: '~/keyfile.json' // or the path to your keyfile
    });
    
    pubsub.createTopic('topicName', function(err, topic) {
      console.log('Response was', err, topic);
    });
  6. AP25 commented on Jun 20, 2015

    @AP25
    AP25
    on Jun 20, 2015
    Author
    More actions

    Hi jgeewax ,

    Yes.Callback isn't get executed at all.Yes above code prints nothing.

  7. jgeewax commented on Jun 20, 2015

    @jgeewax
    jgeewax
    on Jun 20, 2015 via email
    Contributor
    More actions
    Can you put console.log statements around the calls to see what's up? In short... Even if there is an error, it should execute the callback with the error, the only reason for it not to run at all is if there is an error in your code elsewhere preventing the createTopic method from being executed at all....
  8. AP25 commented on Jun 20, 2015

    @AP25
    AP25
    on Jun 20, 2015
    Author
    More actions

    Hi jgeewax,

    Thanks i have created topic successfully. I want to create watch on that pub/sub topic.For that i am using rest request as

    request_Req.post({
    
    url:'https://www.googleapis.com/gmail/v1/users/me/watch',
    headers:{
       'content-type': 'application/json',
       'Authorization': 'Bearer '+ access_token,
    },
    scope : [
        'https://mail.google.com/'
    ],
    
    'body': JSON.stringify({
        'topicName' : "/projects/ProjectId/topics/TopicId",
        'labelIds' : ["INBOX"] 
    });
    }),function(error, resp, body){
    });

    But after executing this code i am getting error as sending test message to Cloud
    PubSub/projects/ProjectID/topics/TopicId : Resource not found(resource=TopicId)

  9. jgeewax commented on Jun 21, 2015

    @jgeewax
    jgeewax
    on Jun 21, 2015
    Contributor
    More actions

    Hi @AP25 ,

    Did you figure out what the problem was ? (So that others reading this could solve it themselves?)

    It looks like your next question isn't really about this library, so you might want to take it over to Stack Overflow to see if someone can help out.

    I'm going to resolve this issue (but still would love to hear how you fixed the first issue!), feel free to re-open if I misunderstood and this is either a bug or a question about gcloud-node.

  10. jgeewax
    closed this as completedon Jun 21, 2015
  11. JustinBeckwith
    assigned
    jgeewax
    on Feb 1, 2021
  12. sofisl
    added 2 commits that reference this issue on Oct 11, 2022

    fix(deps): update dependency mathjs to v11 (#679)

    2c5c94a

    fix(deps): update dependency mathjs to v11 (#679)

    4e2813e
  13. sofisl
    added a commit that references this issue on Nov 11, 2022

    build: update config for node12 (#679)

    6722651
  14. 11 remaining items

  15. sofisl
    added 2 commits that reference this issue on Feb 4, 2026

    migrate code from googleapis/cloud-profiler-nodejs (#7087)

    288deb4

    build: have Kokoro grab service account credentials from secret that …

    dc189eb
  16. GautamSharda
    added a commit that references this issue on Feb 5, 2026

    chore(deps): update dependency @hapi/hapi to v21 (#679)

    3eb23a0
  17. GautamSharda
    added a commit that references this issue on Feb 23, 2026

    chore(deps): update dependency @hapi/hapi to v21 (#679)

    2f30a0c
  18. sofisl
    added 2 commits that reference this issue on Feb 24, 2026

    feat: support apiEndpoint override in client constructor (#679)

    37fe06e

    chore(deps): update dependency @types/nock to v10 (#679)

    fa976fa
  19. GautamSharda
    added a commit that references this issue on Feb 26, 2026

    chore(deps): update dependency @hapi/hapi to v21 (#679)

    4936826
  20. sofisl
    added a commit that references this issue on Feb 26, 2026

    docs: update jsdoc comments (#679)

    ba9ffa3
  21. GautamSharda
    added a commit that references this issue on Mar 12, 2026

    chore(deps): update dependency @types/tmp to v0.2.1 (#679)

    282a8ac
  22. sofisl
    added a commit that references this issue on Mar 17, 2026

    chore: minor TS Config clean-up (#679)

    1933b77
  23. thiyaguk09
    added a commit that references this issue on Mar 18, 2026

    chore(deps): update dependency @types/nock to v10 (googleapis#679)

    b2b945c
  24. GautamSharda
    added 2 commits that reference this issue on Mar 23, 2026

    build: set AUTOSYNTH_MULTIPLE_COMMITS=true for context aware commits (#…

    c9507c3

    build: set AUTOSYNTH_MULTIPLE_COMMITS=true for context aware commits (#…

    360b12c
  25. shivanee-p
    added a commit that references this issue on Mar 27, 2026

    build: set AUTOSYNTH_MULTIPLE_COMMITS=true for context aware commits (#…

    a160674
  26. thiyaguk09
    added a commit that references this issue on May 5, 2026

    build: set AUTOSYNTH_MULTIPLE_COMMITS=true for context aware commits (g…

    d004c83
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @jgeewax
    jgeewax

Labels

api: pubsubIssues related to the Pub/Sub API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.