Julien_Sander | 2023-07-21 09:31:51 UTC | #1
Hello,
I'm trying to migrate our SDK version from 175.2.0 to 183 but it doesn't work (as version 183 is very recent, I tested it with 182 and the result was the same). Indeed, switching to this version causes an error on all API calls. For example:
Unhandled exception: System.ArgumentNullException: Value cannot be null. (Parameter 'source') at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable1 source, Func2 selector) at PureCloudPlatform.Client.V2.Client.ApiClient.CallApi(String path, Method method, List1 queryParams, Object postBody, Dictionary2 headerParams, Dictionary2 formParams, Dictionary2 fileParams, Dictionary2 pathParams, String contentType) at PureCloudPlatform.Client.V2.Api.RoutingApi.GetRoutingSkillsWithHttpInfo(Nullable1 pageSize, Nullable1 pageNumber, String name, List1 id) at PureCloudPlatform.Client.V2.Api.RoutingApi.GetRoutingSkills(Nullable1 pageSize, Nullable1 pageNumber, String name, List`1 id)
Hre is the code that we use to configure and call the API:
var apiClient = Configuration.Default.ApiClient; var region = PureCloudRegionHosts.eucentral1; apiClient.setBasePath(region);
var proxyName = _configuration["ProxyName"]; if (!string.IsNullOrEmpty(proxyName)) { apiClient.ClientOptions.Proxy = new WebProxy(proxyName, true); // Was apiClient.RestClient.Proxy = new WebProxy(proxyName, true); in version 175.2.0 }
var retryConfig = new ApiClient.RetryConfiguration { MaxRetryTimeSec = 5, RetryMax = 2 }; apiClient.RetryConfig = retryConfig;
Configuration.Default.Logger.Level = env.IsProduction() ? LogLevel.LError : LogLevel.LTrace; Configuration.Default.Logger.Format = LogFormat.JSON; Configuration.Default.Logger.LogRequestBody = true; Configuration.Default.Logger.LogResponseBody = true; Configuration.Default.Logger.LogToConsole = false;
var logFile = _configuration["PureCloudLogFile"]; if (!string.IsNullOrEmpty(logFile)) { if (!File.Exists(logFile)) { File.CreateText(logFile); } Configuration.Default.Logger.LogFilePath = logFile; }
apiClient.PostToken(_configuration["ClientId"], _configuration["ClientSecret"]);
new RoutingApi().GetRoutingSkills(pageSize: size, pageNumber: number);
The log genrerated by the SDK are:
{"date":"2023-07-21T09:26:32.7864293Z","level":"trace","method":"Post","url":"xxxxx://login.mypurecloud.de/token","requestHeaders":{"Accept":"application/json","Authorization":"[REDACTED]"},"responseHeaders":{"Date":"Fri, 21 Jul 2023 09:26:32 GMT","Connection":"keep-alive","Inin-Correlation-Id":"a325664e-b744-46ea-4db8-25070531c5a3","Strict-Transport-Security":"max-age=7776000","Vary":"Accept-Encoding"},"statusCode":200} {"date":"2023-07-21T09:26:32.9668623Z","level":"debug","method":"Post","url":"xxxxx://login.mypurecloud.de/token","requestHeaders":{"Accept":"application/json","Authorization":"[REDACTED]"},"correlationId":"","statusCode":200} {"date":"2023-07-21T09:27:08.8517877Z","level":"debug","method":"Get","url":"xxxxx://api.mypurecloud.de/api/v2/routing/queues?pageNumber=1&pageSize=25","requestHeaders":{"Accept":"application/json","Authorization":"[REDACTED]"},"correlationId":"","statusCode":0} {"date":"2023-07-21T09:27:08.8517879Z","level":"debug","method":"Get","url":"xxxxx://api.mypurecloud.de/api/v2/routing/skills?pageSize=25&pageNumber=1","requestHeaders":{"Accept":"application/json","Authorization":"[REDACTED]"},"correlationId":"","statusCode":0}
(I've replaced https with xxxxx so that the forum doesn't think I'm posting links.)
Is there a problem with the way we call APIs via the SDK that worked in old version but is not compatibel with the new one, or is there a bug in the new SDK version?
Thanks
Hemanth | 2023-07-21 15:46:14 UTC | #2
Hi.
Trying to replicate this problem with the configuration you added. Will post here shortly.
Hemanth | 2023-07-25 12:55:21 UTC | #3
Hi Julien
Based on the status code it could be a broken connection or timeout with the Proxy. We are going to make an update for this .
Julien_Sander, post:1, topic:21102
"","statusCode":0}
Will send out the release version once done.
Hemanth | 2023-07-26 16:25:36 UTC | #4
Hi @Julien_Sander
A new Nugget version 184 is released now. Can you check if you are still seeing the issue with this.
BR Hemanth
Julien_Sander | 2023-07-27 06:59:37 UTC | #5
Hi
Thank you for the information. Unfortunately, I get the same behavior with the version 184 of the nugget:
{"date":"2023-07-27T06:56:55.6175043Z","level":"debug","method":"Get","url":"https://api.mypurecloud.de/api/v2/routing/skills?pageSize=25&pageNumber=1","requestHeaders":{"Accept":"application/json","Authorization":"[REDACTED]"},"correlationId":"","statusCode":0}
Regards, Julien
Hemanth | 2023-07-27 18:32:53 UTC | #6
Hi
Can you run the API without Proxy. Is it possible ? Just want to eliminate some cases if it is problem/not a problem with Proxy. Also can you let me know if there is any timeout configured at your side ?
Julien_Sander | 2023-07-28 06:33:42 UTC | #7
Hi
I cant' run API without proxy as there is firewall that block every outbound request that does not pass through the entreprise proxy.
I don't have configured a timeout on my side.
To try to analyse the issue, I use à sniffer and I see that for the token request, the proxy receive correctly the request but for the api call there is no request reaches the proxy.
Regards Julien
Hemanth | 2023-07-28 13:57:08 UTC | #8
Hi
The version 184 will make sure, all the API requests you make go through the proxy if configured. Weird that you still face issue with the broken connection,
Can I get some more details like the version of .NET and Mono version you are using
Is it possible I can give you a snapshot DLL for PlatformClient with some more logging and changes and you can use this snapshot version in your environment ?
and also I would like to add a simple client code CLI which interacts with the PlatformClient which runs in my environment . You can run it in your env , so that we can eliminate any env specific problems that might be causing this.
Best Regards Hemanth
Julien_Sander | 2023-07-28 14:16:49 UTC | #9
Hello
I'm using .Net version 6.0 and I don't use mono.
I'm going on vacation tonight but I'll be available when I get back the week of August 7 to do some tests.
Regards Julien
Hemanth | 2023-08-03 18:16:05 UTC | #10
Hi @Julien_Sander I got a exe file with some log info added which we can share and run on a win os or if you use mac let me know I will change the executable. We can hop on a call on Tuesday and try to mitigate this. (Monday is a bank Holiday in Ireland)
Julien_Sander | 2023-08-08 10:51:35 UTC | #11
Hi,
I tried with the 184.2.0 and it works fine.
Regards Julien
Hemanth | 2023-08-08 13:34:33 UTC | #12
Thanks for the Update Julien
system | 2023-09-08 13:34:52 UTC | #13
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 21102