Azure-sdk-for-js: Items.readChangeFeed optional changeFeedOptions is not actually optional

Created on 18 Nov 2019  路  3Comments  路  Source: Azure/azure-sdk-for-js

  • Package Name: @azure/cosmos
  • Package Version: 3.4.2
  • Operating system: MacOS Catalina
  • [x] nodejs

    • version: 12.13.0

  • [ ] browser

    • name/version:

  • [ ] typescript

    • version:

  • Is the bug related to documentation in

Describe the bug
The API documentation lists changeFeedOptions as an optional parameter for Items.readChangeFeed(), however an object must be passed or the following error is thrown:

Error: changeFeedOptions must be a valid object

This works as expected when an empty object is passed: Items.readChangeFeed({}).

To Reproduce
Steps to reproduce the behavior:

  1. Construct a CosmosClient and connect it to a container.
  2. Call client.container.items.readChangeFeed() with no parameters passed

Expected behavior
An error would not be thrown when no parameters are passed because there are no required parameters per the documentation. If the code requires an object, this should be defaulted within the readChangeFeed function itself.

OR

If a changeFeedOptions parameter IS required (this seems sensible), then the documentation should reflect that.

Screenshots
Here are the docs:
https://docs.microsoft.com/en-us/javascript/api/%40azure/cosmos/items?view=azure-node-latest#readchangefeed-changefeedoptions-
Screen Shot 2019-11-18 at 1 44 47 PM

Here is my error:
Screen Shot 2019-11-18 at 1 51 43 PM

Additional context
Thank you! Let me know if you need any more details 馃槃

Client Cosmos customer-reported

Most helpful comment

Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.

All 3 comments

@SealedSaint Thanks for the report. Looks like a bug. I'll open a PR but in the meantime, you can work around by passing {}

Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.

Thanks, @southpolesteve

Was this page helpful?
0 / 5 - 0 ratings