nodejs-pubsub icon indicating copy to clipboard operation
nodejs-pubsub copied to clipboard

🐞 Bug: maxExtensionTime Ignored in Subscription Constructor

Open AlessandroSteri opened this issue 8 months ago • 3 comments

Please make sure you have searched for information in the following guides.

  • [x] Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
  • [x] Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
  • [x] Check our Troubleshooting guide: https://github.com/googleapis/google-cloud-node/blob/main/docs/troubleshooting.md
  • [x] Check our FAQ: https://github.com/googleapis/google-cloud-node/blob/main/docs/faq.md
  • [x] Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
  • [x] Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
  • [x] Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples

A screenshot that you have tested with "Try this API".

TL;DR: When initializing a Subscription with a custom maxExtensionTime, the value is silently ignored and the default one (1h) is used instead.

Longer Story: In this PR, maxExtensionMinutes was refactored to Subscriber.maxExtensionTime. However, the logic that handled custom values via setOptions was not carried over.

As a result, subscriber always uses the default maxExtensionTime from the constructor. When a custom maxExtensionTime is passed, it’s not applied, because Subscriber.setOptions doesn’t override the default.

Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.

https://gist.github.com/AlessandroSteri/67f0139cff1b92a5d31e47b5d99df99f

A step-by-step description of how to reproduce the issue, based on the linked reproduction.

  1. Create a pubsub Subscription passing maxExtensionTime different from the default 1h as option
  2. Observe that subscription._subscriber.maxExtensionTime is 1h and not the custom one

A clear and concise description of what the bug is, and what you expected to happen.

Bug: When initializing a Subscription with a custom maxExtensionTime, the value is silently ignored and the default one (1h) is used instead.

Expectation: Subscriber.setOptions should set the custom maxExtensionTime

A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **

  • It's a bug introduced in the aforementioned refactor
  • It's clear that the behaviour of that option is to configure the underlining subscriber

AlessandroSteri avatar Jun 10 '25 10:06 AlessandroSteri