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 — pubsub will throw during Subscription.pull when autoAck is on and no messages avail · Issue #455 · googleapis/google-cloud-node

pubsub will throw during Subscription.pull when autoAck is on and no messages avail #455

New issue
Copy link
New issue
Copy link
Closed
#456
Closed
pubsub will throw during Subscription.pull when autoAck is on and no messages avail#455
#456
Copy link
Assignees
ryanseys
Labels
🚨This issue needs some love.api: pubsubIssues related to the Pub/Sub API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
Milestone
Pub/Sub Beta

Description

@jaredrhine
jaredrhine
opened on Mar 21, 2015
Issue body actions

I'm porting to v1beta2 of the pubsub service. In recent versions of gcloud-node, my previous code will abort in Subscription.pull with:

Error: At least one ID must be specified before it can be acknowledged.
    at Subscription.ack     (/Users/jared/work/other/deep/node_modules/gcloud/lib/pubsub/subscription.js:258:11)

I use autoAck and right now there are very few messages on the topic. So I think what's happening is the long-poll completes without receiving a message, and this block in Subscription.pull:

  this.makeReq_('POST', path, null, body, function(err, response) {
    if (err) {
      callback(err);
      return;
    }

    var messages = response.receivedMessages || [];
    messages = messages.map(Subscription.formatMessage_);

    if (self.autoAck) {
      var ackIds = messages.map(function(message) {
        return message.ackId;
      });

      self.ack(ackIds, function(err) {
        callback(err, messages);
      });

calls self.ack with ackIds empty because receivedMessages is empty. I fixed this in my local copy with:

if (self.autoAck && messages.length != 0) {

since there's no point in trying to ack if there are no messages. If I had a bit more time right now, I'd offer a PR with a test, but let's get an issue opened at least to see if the problem has been characterized correctly first.

Activity

Next
  1. jaredrhine commented on Mar 21, 2015

    @jaredrhine
    jaredrhine
    on Mar 21, 2015
    Author
    More actions

    Oh, I think the issue was caused in 1233ac6 during the 1beta2 API bump by @ryanseys (that you for that fix! I'd be dead in the water without that commit, and I'd encourage a 0.13.0 release to pick up those changes). The array always had at least one item in it previously, but now it can be empty.

  2. ryanseys commented on Mar 21, 2015

    @ryanseys
    ryanseys
    on Mar 21, 2015
    Contributor
    More actions

    To clarify, is this still a bug in master?

  3. ryanseys commented on Mar 21, 2015

    @ryanseys
    ryanseys
    on Mar 21, 2015
    Contributor
    More actions

    I realize we do need to release 0.13.0 soon. We've been wrestling with some regression tests for a while that have distracted from a next release. I hope to have something out soon.

  4. jaredrhine commented on Mar 22, 2015

    @jaredrhine
    jaredrhine
    on Mar 22, 2015
    Author
    More actions

    Yes, the behavior described (throw+exit) happens on gcloud-node master as of today, and the code snippets in comment 1 are from master. Thanks!

  5. ryanseys commented on Mar 22, 2015

    @ryanseys
    ryanseys
    on Mar 22, 2015
    Contributor
    More actions

    Yep totally makes sense, I'll get a fix out for this.

  6. ryanseys commented on Mar 22, 2015

    @ryanseys
    ryanseys
    on Mar 22, 2015
    Contributor
    More actions

    Fix, as you suggested, in #456.

  7. ryanseys
    closed this as completedin #456on Mar 22, 2015
  8. jgeewax
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    api: pubsubIssues related to the Pub/Sub API.
    on May 14, 2015
  9. jgeewax
    added this to the Pub/Sub Beta milestone on May 14, 2015
  10. yoshi-automation
    added
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Apr 6, 2020
  11. JustinBeckwith
    assigned
    ryanseys
    on Feb 1, 2021
  12. chingor13
    added a commit that references this issue on Aug 22, 2022

    build: update gapic-generator-typescript to v1.2.10. (#455)

    833cdef
  13. sofisl
    added a commit that references this issue on Sep 15, 2022

    chore: update license headers (#455)

    f80c427
  14. 28 remaining items

  15. GautamSharda
    added a commit that references this issue on Feb 23, 2026

    chore: update github actions configuration (#455)

    d600b98
  16. sofisl
    added 2 commits that reference this issue on Feb 24, 2026

    fix(deps): update dependency google-gax to ^0.22.0 (#455)

    0ffb4c7

    chore: update build config (#455)

    fd57c8c
  17. GautamSharda
    added 2 commits that reference this issue on Feb 25, 2026

    chore: update copyright year for auto-generated protos (#455)

    07f035c

    chore: update github actions configuration (#455)

    66a63c8
  18. sofisl
    added a commit that references this issue on Feb 26, 2026

    Release v2.2.1 (#455)

    cdc1a0c
  19. GautamSharda
    added 3 commits that reference this issue on Mar 5, 2026

    fix(deps): update dependency type-fest to ^0.4.0 (#455)

    4861436

    Release v0.24.1 (#455)

    760217d

    add timeout to options and use it in the reqOpts (#455)

    5c040c2
  20. thiyaguk09
    added a commit that references this issue on Mar 18, 2026

    chore: update build config (googleapis#455)

    a651559
  21. GautamSharda
    added 2 commits that reference this issue on Mar 23, 2026

    fix(deps): update dependency dot-prop to v5 (#455)

    44735a7

    fix(deps): update dependency dot-prop to v5 (#455)

    8de0e95
  22. feywind
    added a commit that references this issue on Mar 27, 2026

    Release v0.24.1 (#455)

    dcd879d
  23. shivanee-p
    added a commit that references this issue on Mar 27, 2026

    fix(deps): update dependency dot-prop to v5 (#455)

    19df557
  24. thiyaguk09
    added a commit that references this issue on May 5, 2026

    fix(deps): update dependency dot-prop to v5 (googleapis#455)

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

Metadata

Metadata

Assignees

  • @ryanseys
    ryanseys

Labels

🚨This issue needs some love.api: pubsubIssues related to the Pub/Sub API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    • Pub/Sub Beta

    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.