EasyPost / easypost-csharp

EasyPost Shipping API Client Library for .NET and .NET Framework applications
https://easypost.com/docs/api
MIT License
66 stars 74 forks source link

[Issue]: API not responding on any call #404

Closed m-imran38 closed 1 year ago

m-imran38 commented 1 year ago

Software Version

4.3.0

Language Version

.NET Framework 4.8

Operating System

Windows 11

What happened?

  1. I have upgraded the EasyPost API to the lates version 4.3.0and updated all the relevant integration.
  2. My old version (2.5) in other project is working fine but in this version it is not responding on any API call.
  3. I have tried creating address, shipment and getting the carrier accounts but there is no response.
  4. For example: string apiKey = System.Environment.GetEnvironmentVariable(API_Key_EP)!; EasyPost.Client client = new EasyPost.Client(apiKey); List<CarrierAccount> carrierAccounts = await client.CarrierAccount.All(); In the code above, the code "await client.CarrierAccount.All()" does not give any response ... image

What was expected?

API call should give any response either success or error.

Sample Code

string apiKey = System.Environment.GetEnvironmentVariable(API_Key_EP)!;
EasyPost.Client client = new EasyPost.Client(apiKey);
List<CarrierAccount> carrierAccounts = await client.CarrierAccount.All();

Relevant logs

No response

nwithan8 commented 1 year ago

Hello, thanks for reporting this!

To help us troubleshoot this, would you mind providing us with a bit more information:

Thanks in advance for helping us help you!

m-imran38 commented 1 year ago

Hello, thanks for the response.

This is an ASP .NET web application and MVC framework, i am calling the API in a class and my method is async. Following is the screenshot of the method.

[image: image.png] image

I have called the API with and without the following line of code but same result: ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

If you need any further information then let me know, if there is some specific configuration that i have missed then also help me regarding that.

Thanks

On Fri, Feb 10, 2023 at 10:40 PM Nate Harris @.***> wrote:

Hello, thanks for reporting this!

To help us troubleshoot this, would you mind providing us with a bit more information:

Thanks in advance for helping us help you!

— Reply to this email directly, view it on GitHub https://github.com/EasyPost/easypost-csharp/issues/404#issuecomment-1426132125, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOEFCGQVCMYAELTE36EMXTWWZ4PBANCNFSM6AAAAAAUXTFXK4 . You are receiving this because you authored the thread.Message ID: @.***>

nwithan8 commented 1 year ago

Sorry @m-imran38 , it looks like the image you tried to attach didn't get uploaded, would you mind sending it again?

m-imran38 commented 1 year ago

The screenshot was inline, anyway i have attached it again.

[image: image.png]

On Sun, Feb 12, 2023 at 4:43 AM Nate Har image

ris @.***> wrote:

Sorry @m-imran38 https://github.com/m-imran38 , it looks like the image you tried to attach didn't get uploaded, would you mind sending it again?

— Reply to this email directly, view it on GitHub https://github.com/EasyPost/easypost-csharp/issues/404#issuecomment-1426900072, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOEFCGO72H2LOFGSNKMWIDWXAPYPANCNFSM6AAAAAAUXTFXK4 . You are receiving this because you were mentioned.Message ID: @.***>

nwithan8 commented 1 year ago

@m-imran38 It doesn't seem like GitHub automatically adds photos when responding via email, you might have to respond on the GitHub page directly for the attachment to work.

m-imran38 commented 1 year ago

image

nwithan8 commented 1 year ago

@m-imran38 Thank you for the image. Personally, nothing is immediately jumping out to me as an issue, but if you wouldn’t mind, could you confirm a few things for us to help us debug?

  1. Is your API key being set and passed into the client properly? It seems like you are using a static key name, and pulling the API key from the environment by that key name. When an API call is being made, the API should throw an unauthorized exception if the API key provided is invalid. If that’s the case, in the code snippet you shared, the API error may have triggered the "catch" clause?
  2. Did an API call occur? Is there a way to see if an actual HTTP request was attempted by the EasyPost client, perhaps in your logs somewhere, or via a debugging session?

Thank you again for helping us figure this out.

m-imran38 commented 1 year ago

Screenshot 2023-02-17 102101 Yes, the API key is passed as you can see in the screenshot, and whichever method I called there is no exception and no response.

m-imran38 commented 1 year ago

https://user-images.githubusercontent.com/10240648/219566830-b6ede7b9-1061-40ba-a426-8a0cf074d096.mp4

here is the debug session of the api call.

nwithan8 commented 1 year ago

Thank you for confirming those details, and for the video, very helpful to see it in action.

The only thing I can see is, the sync_shipment_accounts function is marked asynchronous, but it is being called asynchronously upstream? Is it being called as await sync_shipment_accounts(storeId)?

Other than that, you might be able to enter into the EasyPost library (go into the All() function) and narrow down where in that function things are stalling.

Hopefully we can figure this out!

m-imran38 commented 1 year ago

Thank you for your help I am able to figure out the issue and able to fix it and it is working now. This was the issue: "Is it being called as await sync_shipment_accounts(storeId)".

nwithan8 commented 1 year ago

Glad we could figure it out!