question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`rmClient.resourceGroups.list().byPage({ maxPageSize: 100 })` throws "maxPageSize is not supported by this operation" ` after upgrading to @azure/arm-resources 5.1.0

See original GitHub issue
  • Package Name: @azure/arm-resources
  • Package Version: 5.1.0
  • Operating system: Windows 10
  • [x ] nodejs 14
    • version:
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug A clear and concise description of what the bug is.

After upgrading @azure/arm-resources from 5.0.1 to 5.1.0,

rmClient.resourceGroups.list().byPage({ maxPageSize: 100 })

throws error

maxPageSize is not supported by this operation

To Reproduce Steps to reproduce the behavior:

  1. Install @azure/arm-resources 5.1.0
  2. Create test.js with following content
function main() {
  const rmClient = new ResourceManagementClient(azureToken, subscriptionId);
  await rmClient.resourceGroups.list().byPage({ maxPageSize: 100 })
}
  1. node test.js

Expected behavior A clear and concise description of what you expected to happen. It returns resource group list

Additional context

Seems it is related to https://github.com/Azure/azure-sdk-for-js/commit/313d67cae922c3522d09660095199e94954329fb?diff=unified#diff-3202b97f077aef045d6cd23e831431555b9da1cd1cc4da902859de976190f969 image It this by design or a bug?

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
xirzeccommented, Nov 16, 2022

@xirzec Do you have plan to support await rmClient.resourceGroups.list().byPage({ maxPageSize: 100 }) in future releases? We need to decide whether we fix @azure/arm-resources version to < 5.1 temporarily or change our code logic.

Are you saying that today you are passing .byPage({ maxPageSize: 100 })? In the previous version this would have done absolutely nothing with the parameter, which is why we put the error message in the updated codegen.

1reaction
xirzeccommented, Nov 15, 2022

@a1exwang thanks for reporting! The main issue here is we don’t currently have a way for swagger authors to declare the pagination parameter of their SDK. In the case of the above example, it looks like the service uses top to control the number of resources returned:

https://github.com/Azure/azure-sdk-for-js/blob/ae240b289bcb5007f48028f548867a61fc1eaeed/sdk/resources/arm-resources/src/models/index.ts#L2186

So I think rmClient.resourceGroups.list({top: 100}).byPage() should accomplish what you want, albeit not as elegantly as we would like.

/cc @joheredi wanted to put this on your radar for something we could do better in CADL-driven pagination.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found