docusign / docusign-esign-csharp-client

The Official Docusign C# Client Library used to interact with the eSignature REST API. Send, sign, and approve documents using this client.
https://developers.docusign.com/docs/esign-rest-api/sdks/csharp/
MIT License
130 stars 159 forks source link

API .NET 6 - Error with EnvelopesApi #384

Closed Zibeug closed 1 year ago

Zibeug commented 2 years ago

Hi all,

I mad a prototype in Console .NET 6 with the DocuSign.Esign.dll. Everything working great but I just start implementation of the prototype in the definitive project and I got each time a error when I use EnvelopesApi.

The error is : One or more errors occurred. (Error setting value to 'StatusChangedDateTime' on 'DocuSign.eSign.Model.Envelope'.)

I use the last version of Nuget package.

My init code :

`

        _client = new ApiClient(_apiUrl);

        _integrationKey = integrationKey;

        _userId = userId;

        _authUrl = authUrl;

        _accountId = accountId;

        _templateId = templateId;

        _rsaKey = File.ReadAllText(rsaKey);

        _oAuthToken = _client.RequestJWTUserToken(_integrationKey, _userId, _authUrl, Encoding.UTF8.GetBytes(_rsaKey), 1, _scopes);

        _envelopesApi = new EnvelopesApi(_client);
        _templatesApi = new TemplatesApi(_client);`

Any idea why I got this change ?

Thank you

Cheers,

Zibeug

sylvainleb376 commented 2 years ago

Hello Zibeug,

I suppose then you're using the DocuSign.Esign.dll last version 5.12.0 I tried to create an envelope using it without issue. Could you please provide a stack trace of this test and provide matching API logs (https://support.docusign.com/guides/ndse-user-guide-api-request-logging) If there is any sensitive datas, don't hesitate to rather open a Docusign support case in order to follow up this issue

Zibeug commented 2 years ago

11_OK_GetEnvelope.txt

There is my test. It's look very strange because the request return 200 OK but always the same error.

One time on StatusDateTime and for this request : Catch error:One or more errors occurred. (Error setting value to 'CreatedDateTime' on 'DocuSign.eSign.Model.Envelope'.)

sylvainleb376 commented 2 years ago

It's possible the error appears in upstream, before the API request is sent and reaches Docusign server. It would explain why there is no error inside API logs. With this messgage error, it seems to be a problem with an inconsistent value being used with the field CreatedDateTime. Could you please provide the stack trace with full details of the values being used?

Zibeug commented 2 years ago

I think the values are not the problem because I made an another project with same values and It's working great. (CopyPaste)

It's an API made by another company and I'm working on DocuSignPart. But when I make my own solution with a API project that work great.

Maybe something with the timezone of the API ?

Zibeug commented 2 years ago

I think I've found the problem after a long time of debug. I start my service in a thread. Outside of this thread everything is working great. Inside the thread I got the error.

sylvainleb376 commented 2 years ago

That's a good news indeed. It could be interesting anyway to understand why it didn't work using a thread. We would need then to have a stack trace/concrete elements in order to investigate. Let me know if you wanted to continue the analysis in this way...

Zibeug commented 2 years ago

I found the problem It's during the deserialize of JsonConvert. I tried to put a random string and I got a return from ApiClient model. After downloaded your code I changed all Model with Date in string to DateTime and the error is gone. Maybe you can change it for the new version ! :-D