Amazon-SP-API-CSharp icon indicating copy to clipboard operation
Amazon-SP-API-CSharp copied to clipboard

Unknown Host Exception - sts.it.amazonaws.com on simple code

Open giunapmicrotec opened this issue 2 years ago • 3 comments

Hello Guys, i'm testing this library, with SampleCode project.

After correctly configured appsettings.json file entry with my key, id, secret, token, and any other setting, i tried to run a simple code:

ParameterOrderList serachOrderList = new ParameterOrderList(); serachOrderList.CreatedAfter = DateTime.UtcNow.AddMinutes(-600000); serachOrderList.OrderStatuses = new List<OrderStatuses>(); serachOrderList.OrderStatuses.Add(OrderStatuses.Canceled); var orders = amazonConnection.Orders.GetOrders(serachOrderList);

But i had an exception unhandled:

  • System.Net.Http.HttpRequestException: 'Unknown Host. (sts.it.amazonaws.com:443)'

at this line: response1 = await STSClient.AssumeRoleAsync(req, cancellationToken);

in SignWithSTSKeysAndSecurityTokenAsync() method, in [FikaAmazonAPI.Services] TokenGeneration class.

Please, can someone help me to investigate about this issue?

Thanks in advance.

Bye

GN

giunapmicrotec avatar Aug 24 '23 11:08 giunapmicrotec

I'm investigate around exception: from here:

  • https://docs.aws.amazon.com/general/latest/gr/sts.html

it looks like sts.it.amazonaws.com doesn't exist.

How is this determined?

Thanks

giunapmicrotec avatar Aug 24 '23 13:08 giunapmicrotec

From this: https://github.com/abuzuhri/Amazon-SP-API-CSharp/issues/273#issuecomment-1207403111 i found "IT" in my AWS profile config.

Switched to "eu-south-1", code working now.

I will close this issue.

giunapmicrotec avatar Aug 24 '23 16:08 giunapmicrotec

So does mean that library is dependent on the "/.aws/config/region" setting? If so, how am I going to configure the application in production? Who will create the /config file in /Users/.aws? [Locally, the AWS CLI installation will have created it]

giunapmicrotec avatar Aug 25 '23 11:08 giunapmicrotec