googleapis / nodejs-pubsub

Node.js client for Google Cloud Pub/Sub: Ingest event streams from anywhere, at any scale, for simple, reliable, real-time stream analytics.
https://cloud.google.com/pubsub/
Apache License 2.0
518 stars 228 forks source link

Misleading error message #1795

Open hspak opened 1 year ago

hspak commented 1 year ago

Environment details

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: https://github.com/googleapis/nodejs-pubsub/blob/6c38e7bd29d1351830c80ade7162b6d5cf9cbe1e/src/topic.ts#L861-L887

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.

feywind commented 1 year ago

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