Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M365 flow run list returns not all runs #2458

Closed
MuesliP opened this issue May 28, 2021 · 9 comments
Closed

M365 flow run list returns not all runs #2458

MuesliP opened this issue May 28, 2021 · 9 comments
Assignees
Milestone

Comments

@MuesliP
Copy link

MuesliP commented May 28, 2021

Description

When running the command flow run list not all runs will be returned. In our environment we have a flow with 122 runs and only the last 50 runs are returned.

Steps to reproduce

m365 login --authType password --userName [USER] --password [PASSWORD]
m365 flow run list -e [DEFAULT_ENVIRONMENT] -f [FLOW ID] -o "json"

Expected result

We expect all flow run items, as seen on the web page.

Actual result

Only 50 results. Maybe there is a paging mechanism?

Environment

Windows Server 2016
Microsoft PowerShell PSVersion 5.1.14393.3866
CLI for Microsoft 365 v3.9.0

@waldekmastykarz
Copy link
Member

Thank you for reporting the issue and we'll have a look at it asap. Sorry for the trouble

@MuesliP
Copy link
Author

MuesliP commented May 28, 2021

Thanks for the reply. I have analyzed the request further. It looks like the query is executed after retrieving all flow runs and the endpoint https://management.azure.com/providers/Microsoft.ProcessSimple/environments/[DEFAULT_ENVIRONMENT]/flows/[FLOW_ID]/runs?api-version=2016-11-01 returns only 50 results and the next link. But from performance side, I don't think that it would be a good idea to follow all next links, if the filter is only applied client side.

@waldekmastykarz
Copy link
Member

Thanks for looking into it. The environment and flow ID are passed to the API so what you get back are all runs for the specified flow. With that, we should be following the next link as we're not applying any additional filters.

@Abderahman88
Copy link
Contributor

@waldekmastykarz I can confirm @MuesliP issue. Max 50 runs are returned by the CLI even if you have more runs.

The fix is to change the extension class.

//class FlowRunListCommand extends AzmgmtCommand {
class FlowRunListCommand extends AzmgmtItemsListCommand

AzmgmtItemsListCommand takes the nextLink parameter into account.

I've tested this and it works.

Assign to me please and I will make a PR.

@waldekmastykarz
Copy link
Member

Awesome, appreciate your help @Abderahman88 👏

@MuesliP
Copy link
Author

MuesliP commented May 28, 2021

Thanks for the support @Abderahman88 and @waldekmastykarz and the quick clarification! 👏

@waldekmastykarz
Copy link
Member

We've just release a preview version with the bug fixed. You can check if it works as intended by installing it from npm: npm i -g @pnp/cli-microsoft365@next. Once again, thank you for reporting the issue and @Abderahman88 thank you for the fix 👏

@waldekmastykarz waldekmastykarz added this to the v3.10 milestone May 30, 2021
@MuesliP
Copy link
Author

MuesliP commented May 30, 2021

I have just tried the previous version and it now works as expected. Thanks a lot!

@waldekmastykarz
Copy link
Member

Excellent! Thank you for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants