Aws-sdk-ios: AWSS3TransferUtility image upload | Error when device time is not correct

Created on 22 Aug 2016  路  7Comments  路  Source: aws-amplify/aws-sdk-ios

Hi,

I am facing an issue while uploading an image (~200kb) to AWS using AWS IOS sdk. I have registered my own AWSS3TransferUtility with my AWSServiceConfiguration object.

I am getting below error when trying to upload an image on AWS and my device time is not accurate, for example my device clock is one day ahead of current time.

Error Domain=com.amazonaws.AWSS3TransferUtilityErrorDomain Code=1 "(null)"
Status code 403

  1. During some code debugging I saw a method named aws_setRuntimeClockSkew which can be used to handle this case, but I have not seen this method being called during debugging.
  2. Do I need to calculate the skew by using some library like IOS-NTP and than call aws_setRuntimeClockSkew method manually to set the skew time before invoking the upload image method?

Thanks in advance.

Most helpful comment

Any update on this ticket ? is this being resolved in the newer AWS SDK versions ?

All 7 comments

Hi, could you please post the response headers that you received on this request?

Thanks for the reply, below is the request and response header I am getting. As you can see I change the date to 31 august which reflects in request header and the server date is 29 Aug in the response header.

Request header

{
    "Content-Type" = "application/x-amz-json-1.1";
    Host = "cognito-identity.xxxxxx.amazonaws.com";
    "User-Agent" = "aws-sdk-iOS/2.4.1 iPhone-OS/9.3 en_US";
    "X-Amz-Date" = 20160831T070943Z;
    "X-Amz-Target" = "AWSCognitoIdentityService.GetId";
}

response header

{
    "Content-Length" = 63;
    "Content-Type" = "application/x-amz-json-1.1";
    Date = "Mon, 29 Aug 2016 07:09:35 GMT";
    "x-amzn-RequestId" = "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx";
}

Please re-open if you have further comments

You will need to set the clockskew manually with aws_setRuntimeClockSkew

In my case, it was because of wrong date and time of device. Thanks .

Exactly this is what I am doing, set the wrong date time on device before sending the request on AWS. I tried it with both IOS sdk and Android sdk but I am getting this error on IOS sdk which means that the android sdk is somehow handling this case and IOS sdk is not doing the thing which Android sdk is doing.

I have got this issue on my prod users thats why I thought to raise this issue so it get fixed on AWS s3 IOS sdk.

Any update on this ticket ? is this being resolved in the newer AWS SDK versions ?

Was this page helpful?
0 / 5 - 0 ratings