Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

Not receiving all messages #42

@vcrepin

Description

@vcrepin
  • OS: Google Container Engine (Kubernetes)
  • Node.js version: gcr.io/google_appengine/nodejs
  • npm version:
  • @google-cloud/pubsub version: 0.16.2

I have a very simple subscription on a topic that runs in Container Engine. The code is the same as your examples:

const pubsub = require('@google-cloud/pubsub')();

const projectId = process.env.GOOGLE_CLOUD_PROJECT;
const topic = pubsub.topic('projects/' + projectId + '/topics/security-logs');
const subscription = topic.subscription('projects/' + projectId + '/subscriptions/securitySubscription');

subscription.on('error', function (err) {
    "use strict";
    console.error("Subscription error: " + err);
});

function onMessage(message) {
    "use strict";
    // Called every time a message is received.
    logger.log("Subscription message received: " + JSON.stringify(message));
    const data = Buffer.from(message.data).toString('utf-8');
    logger.log("message.data: " + data);
    message.ack();
}

subscription.on('message', onMessage);

The problem is that not all messages are received. I would say a little more than 50% are.

I see in my logs that messages are successfully sent by publishers (I get messageIds) but the subscription does not get them all. I have only one subscriber.

Any idea what might be wrong ?

Metadata

Metadata

Labels

🚨This issue needs some love.api: pubsubIssues related to the googleapis/nodejs-pubsub API.priority: p2Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions