Skip to content

Pub/Sub onMessage data is undefined  #1726

@lafama

Description

@lafama

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_();
  }

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions