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

Misleading error message #1795

Open
hspak opened this issue Aug 7, 2023 · 1 comment
Open

Misleading error message #1795

hspak opened this issue Aug 7, 2023 · 1 comment
Assignees
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@hspak
Copy link

hspak commented Aug 7, 2023

Environment details

  • OS: Cloud Run Service
  • Node.js version: 18.16.0
  • npm version: 9.5.1
  • @google-cloud/pubsub version: 3.5.0

Steps to reproduce

  1. Publish messages with orderingKey set.
  2. Wait for a message to fail.
  3. All subsequent messages fail, but with a timeout error message (way before the timeout).

I suspect that we are running into this behavior, but the error message does not seem indicative of that:

nodejs-pubsub/src/topic.ts

Lines 861 to 887 in 6c38e7b

/**
* In the event that the client fails to publish an ordered message, all
* subsequent publish calls using the same ordering key will fail. Calling
* this method will disregard the publish failure, allowing the supplied
* ordering key to be used again in the future.
*
* @param {string} orderingKey The ordering key in question.
*
* @example
* ```
* const {PubSub} = require('@google-cloud/pubsub');
* const pubsub = new PubSub();
* const topic = pubsub.topic('my-topic', {messageOrdering: true});
*
* const orderingKey = 'foo';
* const data = Buffer.from('Hello, order!');
*
* topic.publishMessage({data, orderingKey}, err => {
* if (err) {
* topic.resumePublishing(orderingKey);
* }
* });
* ```
*/
resumePublishing(orderingKey: string): void {
this.publisher.resumePublishing(orderingKey);
}

I'm sorry I don't have a good, small reproduction case but here's effectively the code being run:

import { PubSub, Topic as PubSubTopic } from '@google-cloud/pubsub';

const pubsub = new PubSub(clientConfig);
const topic = pubsub.topic('TopicName', {
  messageOrdering: true,
  batching: {
    maxMessages: 100,
    maxMilliseconds: 250,
  },
};

await topic.publishMessage({
  data: somePayload,
  attributes: someAttrs,
  orderingKey: 'myOrderingKey'
});                                        

Here's a timestamp from Cloud Logging showing that the publish failed due to a timeout after 50 seconds only after less than a second of running:
Screenshot 2023-08-07 at 2 27 57 PM

I believe the error message is misleading and incorrect here.

@hspak hspak added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Aug 7, 2023
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the googleapis/nodejs-pubsub API. label Aug 7, 2023
@feywind
Copy link
Collaborator

feywind commented Aug 11, 2023

@hspak Thanks for the issue. It does look like there's something odd going on there with the error message.

@feywind feywind added priority: p3 Desirable enhancement or fix. May not be included in next release. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Feb 8, 2024
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 googleapis/nodejs-pubsub API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants