landgraf-dev / aws-sdk-delphi

AWS (Amazon Web Services) SDK for Delphi.
Other
129 stars 31 forks source link

GetObjectRequest - Error unmarshalling response back from AWS #18

Open lrighetti68 opened 1 month ago

lrighetti68 commented 1 month ago

Hello,

using aw-sdk-delphi TGetObjectRequest I have the error "Error unmarshalling response back from AWS" with any bucket and any object. It's ok using standard delphi component TAmazonConnectionInfo (see attachment)

get.txt

Thanks for your great job!

wlandgraf commented 1 month ago

Are you able to send code that we can reproduce at our side? Maybe a small console project that reads a public S3 bucket?

lrighetti68 commented 1 month ago

here it is Example4AwsSdkDelphi.zip Screenshot 2024-10-21 170913

wlandgraf commented 1 month ago

In your demo, lower button raises error 403. Upper button raises this error:

image

wlandgraf commented 1 month ago

"Access key you provided is not in our database". I cannot reproduce the problem with your project.

lrighetti68 commented 1 month ago

I think I understand where the problem is: The S3 response contains the datetime "Wed, 23 Oct 2024 07:21:43 GMT" but we are in Italy and the month names are different ("October" -> "Ottobre").

The datetime is checked in TAWSSDKUtils.TryRfc822ToDateTime() calling the function TryStrToDateTime(Copy(S, 5, 20), D, FRFC822FormatSettings);

FRFC822FormatSettings is created in the TAWSSDKUtils.Create class constructor with: FRFC822FormatSettings := TFormatSettings.Create; without any parameters -> "Initialize a TFormatSettings record with the current default values ​​provided by the operating system" (Italy settings)

To validate the date in a different region we need to create FormatSettings with the parameter 'en-US': FRFC822FormatSettings := TFormatSettings.Create('en-US');

By doing so I can use the function without any problems.

Thanks a lot!