Google-cloud-node: publishTime not visible on Pub/Sub message from emulator

Created on 18 Jan 2017  路  4Comments  路  Source: googleapis/google-cloud-node

I am testing out publishTime and it seems to not be present, at least while using the simulator. The nanos field is 0 which makes this check return false: https://github.com/GoogleCloudPlatform/google-cloud-node/blob/master/packages/pubsub/src/subscription.js#L367

bug pubsub

Most helpful comment

I also don't see publishTime from pubsub messages from the emulator. The docs also don't seem to show the publishTime field: https://cloud.google.com/pubsub/docs/emulator#using_the_emulator

{
  "messages": [
      {
          "subscription": "projects/PUBSUB_PROJECT_ID/subscriptions/SUBSCRIPTION_ID",
          "message": {
              "data": "TWVzc2FnZSBudW1iZXIgMQ==",
              "messageId": "10",
              "attributes": {}
          },
          "id": 1
      },
      ...
  ]
}

I know this is an old issue so let me know if I should create a new issue.

All 4 comments

Thanks for the report! This should do:

- if (publishTime.seconds && publishTime.nanos) {
+ if (is.number(publishTime.seconds) && is.number(publishTime.nanos)) {

Thanks- should I make a PR?

It's hard to say no to that! 馃憤

I also don't see publishTime from pubsub messages from the emulator. The docs also don't seem to show the publishTime field: https://cloud.google.com/pubsub/docs/emulator#using_the_emulator

{
  "messages": [
      {
          "subscription": "projects/PUBSUB_PROJECT_ID/subscriptions/SUBSCRIPTION_ID",
          "message": {
              "data": "TWVzc2FnZSBudW1iZXIgMQ==",
              "messageId": "10",
              "attributes": {}
          },
          "id": 1
      },
      ...
  ]
}

I know this is an old issue so let me know if I should create a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stephenplusplus picture stephenplusplus  路  3Comments

pputhran picture pputhran  路  4Comments

hvolschenk picture hvolschenk  路  4Comments

dsimmons picture dsimmons  路  4Comments

mik115 picture mik115  路  5Comments