`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
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
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:
- Install @azure/arm-resources 5.1.0
- Create test.js with following content
function main() {
const rmClient = new ResourceManagementClient(azureToken, subscriptionId);
await rmClient.resourceGroups.list().byPage({ maxPageSize: 100 })
}
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
It this by design or a bug?
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.@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.