DynamicsNinja / FlowExecutionHistory

XrmToolBox tool that allows you to browse Power Automate flow runs by applying multiple filters including multiple flows at the same time.
MIT License
9 stars 0 forks source link

Error: Value cannot be null #3

Closed pmolensky closed 1 year ago

pmolensky commented 1 year ago

I receive below error when trying to view the flow run history:

************** Exception Text **************
System.ArgumentNullException: Value cannot be null.
Parameter name: collection
   at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at Fic.XTB.FlowExecutionHistory.Services.FlowClient.GetFlowRuns(Flow flow, String status, DateTimeOffset dateFrom, DateTimeOffset dateTo)
   at Fic.XTB.FlowExecutionHistory.FlowExecutionHistory.<>c__DisplayClass18_1.<GetFlowRuns>b__3(Flow f)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)

does this help? Do you need any other information?

pmolensky commented 1 year ago

I see a mention of datetime. My locale is a mix of US and NL In the tool: image My region settings: image

FYI, I've tried multiple orgs and tenants. Same error on all

DynamicsNinja commented 1 year ago

I can't reproduce the issue because it's probably an error when calling the Power Automate API. I added the logging in the new release so we can catch your issue.

Please download the new version and do the test again, if it fails it will show the error from the API so we will have more information on what is causing the issue.

pmolensky commented 1 year ago

Thanks, I now see "You are not permitted to make flows in this 'flows'". I (should) have appropriate permissions as I can see the flows and run history from the UI. Changed login to match the owner of the flows, and also tested with a different tenant&org where I'm full admin (AD and D365). All give the same access denied error.

image

DynamicsNinja commented 1 year ago

I managed to reproduce the error in a case where I selected a connection for one environment and on the login prompt I connected to another environment on a different tenant.

pmolensky commented 1 year ago

I doublechecked to make sure, I use the same creds in both connections. I try to connect to a different tenant and org, not my main tenant. Could it be the Automate API is assuming my own tenant and not correctly connecting to the clients tenant?

DynamicsNinja commented 1 year ago

I don't have such an account to test it out at my end, but I changed the code that it uses tenant ID while initiating a manual login popup so it could work now.

Please download the new version and test it out.

pmolensky commented 1 year ago

image

DynamicsNinja commented 1 year ago

Which connection method do you use for XTB?

pmolensky commented 1 year ago

AuthType=Office365

DynamicsNinja commented 1 year ago

I assume it's via the connection string in this popup?

image

DynamicsNinja commented 1 year ago

AuthType=Office365

Also, you should definitely consider updating the connection to use a supported method since Office365 is deprecated for a while now

https://learn.microsoft.com/en-us/power-platform/important-changes-coming#deprecation-of-office365-authentication-type-and-organizationserviceproxy-class-for-connecting-to-dataverse

pmolensky commented 1 year ago

I knew this, should have seen this :-) I checked, it's still the result when creating a connection using the wizard. I created a new connection using the "OAuth/MFA" option, instead of the "Connection Wizard" and now I see the flow history 🥳

DynamicsNinja commented 1 year ago

Glad that we found out what was causing the issue 😉