Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pub/Sub onMessage data is undefined #1726

Closed
lafama opened this issue Oct 19, 2016 · 2 comments
Closed

Pub/Sub onMessage data is undefined #1726

lafama opened this issue Oct 19, 2016 · 2 comments
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API.

Comments

@lafama
Copy link

lafama commented Oct 19, 2016

Environment details

  • OS: Mac OS
  • Node.js version: 6.8.1
  • npm version:3.8.10
  • google-cloud-node version:0.42.2

Steps to reproduce

  1. require google-cloud
var pubsub = gcloud.pubsub;
var topic = pubsubClient.topic('my-topic');
topic.subscribe('subscription-name', options, function(err, subscription) {
  subscription.on('message', function(message){
    console.log(message.data) //message.data = Contents of the message. is undefined and all the data contents are in the message variable 
  });
});

Example (content of the message, the item_id,body and to are supposed to be under data) according to https://github.com/GoogleCloudPlatform/google-cloud-node/blob/v0.42.2/packages/pubsub/src/subscription.js#L142

ackId=RUXMjY, id=966xxxx, item_id=574, body=xxxx test, to=xxxx87832, , ack=function () { [native code] }, skip=function () {
    delete self.inProgressAckIds[message.ackId];
    self.refreshPausedStatus_();
  }
@lafama
Copy link
Author

lafama commented Oct 19, 2016

Got it fixed. Was a problem with my code

@lafama lafama closed this as completed Oct 19, 2016
@stephenplusplus stephenplusplus added the api: pubsub Issues related to the Pub/Sub API. label Oct 19, 2016
@stephenplusplus
Copy link
Contributor

Phew!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API.
Projects
None yet
Development

No branches or pull requests

2 participants