Bertverbeek4PS / bc2adls

Exporting data from Dynamics 365 Business Central to Azure data lake storage or MS Fabric lakehouse
MIT License
49 stars 20 forks source link

Version 2.20 An invalid argument was passed to a 'List' data type method. #98

Closed hanksteen closed 6 months ago

hanksteen commented 6 months ago

Hi,

Thanks for continuing this product!

I'm having various issues with version 2.20 which I don't get if I instead install version 2.14. Since it is working with 2.14 I don't believe (hope) it is related to my setup in azure or the Setup in the BC page.

I'm not able to export the schema to Azure Data Lake. When I try to export the schema I get the following error.

An invalid argument was passed to a 'List' data type method.

AL call stack: "ADLSE Gen 2 Util"(CodeUnit 82568).AcquireLease line 24 - Azure Data Lake Storage Export by The bc2adls team "ADLSE Communication"(CodeUnit 82562).UpdateCdmJsons line 12 - Azure Data Lake Storage Export by The bc2adls team "ADLSE Execute"(CodeUnit 82561).ExportSchema line 34 - Azure Data Lake Storage Export by The bc2adls team "ADLSE Execution"(CodeUnit 82569).SchemaExport line 28 - Azure Data Lake Storage Export by The bc2adls team "ADLSE Setup"(Page 82560)."SchemaExport - OnAction"(Trigger) line 4 - Azure Data Lake Storage Export by The bc2adls team

I'm not capable of BC debugging on my own :(.

Once I've downgraded to version 2.14 the Schema Export and Export works fine.

hanksteen commented 6 months ago

I managed to get some help setting up the debugging.

            `ADLSEHttp.InvokeRestApi(Response, StatusCode)`

Response = '' StatusCode = 200 LeaseIdHeaderValues := ADLSEHttp.GetResponseHeaderValue('x-ms-lease-id'); Return an empty list LeaseIdHeaderValues.Get(1, LeaseID); Fails because there is no item 1 in the list.

Bertverbeek4PS commented 6 months ago

Hi @hanksteen expect some delay because currently this week and next week I'm at a business event.

Sorry that there is an error in it! I will have a look when I got time.

acjdekorte commented 6 months ago

I am running into the same issue on an environment, while it runs perfectly on the other. The failed environment is a cloud environment on a different tenant compared to the tenant of Azure Data Lake. The environment in which it is successfull is a OnPrem environment. May be this information is beneficial when trying to solve the issue.

hanksteen commented 6 months ago

I'm on cloud as well, but Azure data lake and BC is in the same tenant.

I have similar problems when trying with OneLake as well, but one thing at a time :). Hopefully it is the same issue.

acjdekorte commented 6 months ago

@hanksteen @Bertverbeek4PS I just noticed that cloud version is 2.20 and OnPrem is 2.21. The difference between both versions is that 2.21 does not longer hold the functionality for retries.

Unfortunately on my 'Export to Azure Data Lake Storage' the number of retries was set to 0. In combination with the code on line 140, I think that might cause some problems. image

Unfortunately I still not able to acquire a lease, when I set the number of retries to 1. image

acjdekorte commented 6 months ago

I think that I found the real issue (which should be fixed in version 2.21).

The code of InvokeRestApi (codeunit 82563 "ADLSE Http") does an exit, when the call is successfull on line 143 image

But the response is retrieved on line 192-193, which is never reached by the code. image

Unfortunately I am not able to test at our environment, since I am lacking the sufficient rights to install extensions.

Bertverbeek4PS commented 6 months ago

@acjdekorte @hanksteen I have tested the newest package that you can find here: https://github.com/Bertverbeek4PS/bc2adls/releases/tag/2.20.0 And it is working correctly on that version.

Sorry for the bug in it!

hanksteen commented 6 months ago

I tried with The bc2adls team_Azure Data Lake Storage Export_2.21.63.0.app and now it worked. Thanks for the fix!