Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get error while uploading a file on S3 bucket with latest release 2.37.1 #5443

Closed
VijayInnovana opened this issue Sep 25, 2024 · 12 comments
Closed
Labels
question General question s3 Issues related to S3

Comments

@VijayInnovana
Copy link

Getting error while uploading a file on S3 bucket with latest release 2.37.1
before this release working file, with the previous release 2.36.7 its working fine. After updating pods app getting this error :

Domain=com.amazonaws.AWSS3TransferUtilityErrorDomain Code=2 "Client Error" UserInfo={Server=AmazonS3, Transfer-Encoding=Identity, Connection=close, Content-Type=application/xml, Date=Wed, 25 Sep 2024 11:43:20 GMT, x-amz-request-id=1Y3CXQFS4V3V9E7R, NSLocalizedFailureReason=bad request, x-amz-id-2=6laFTPQe0JwIaqGf5RNozsa0VEzyuEpIj+OAlvZTDkVWqWraAa4klCl40p/mQUlYoC4M0L0TyIA=, HTTPStatusCode=400, NSLocalizedDescription=Client Error, x-amz-bucket-region=ap-south-1})

We used this function for uploading file on S3
"AWSS3TransferUtility.default().uploadData"

Please resolved this issue ASAP. My user base facing issue with file uploads on productions environments.

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Sep 25, 2024
@ruisebas
Copy link
Member

ruisebas commented Sep 25, 2024

Hi @VijayInnovana , thanks for reaching out.

There were no functionality changes made to the AWSS3TransferUtility between versions 2.36.7 and 2.37.1, so it's unclear why you're now getting an error.

To help us investigate further, please provide the following:

  • The contents of your awsconfiguration.json file with sensitive information redacted.
  • Verbose logs when you attempt to upload. You can enable verbose logging by doing this:
    AWSDDLog.sharedInstance.logLevel = .verbose
    AWSDDLog.sharedInstance.add(AWSDDOSLogger.sharedInstance)

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Sep 25, 2024
@ruisebas ruisebas added bug Something isn't working s3 Issues related to S3 and removed pending-triage Issue is pending triage labels Sep 25, 2024
@VijayInnovana
Copy link
Author

VijayInnovana commented Sep 25, 2024

we use default configurations like this :

let credentialsProvider = AWSStaticCredentialsProvider(accessKey: accessKey, secretKey: secretKey)
let configuration = AWSServiceConfiguration(region: AWSRegionType.init(rawValue: AWSRegion.getRawValue(from: awsAccessRegion)) ?? .Unknown, credentialsProvider: credentialsProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration

After updating pods from 2.36.7 to 2.37.1 this issue occurs. when I am downgrade the pods from 2.37.1 to 2.36.7 without any app code changed, its working fine now.

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify team member label Sep 25, 2024
@ruisebas
Copy link
Member

Thanks, we'll take a look. But please provide the verbose logs as well.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Sep 25, 2024
@ruisebas ruisebas added the pending-community-response Issue is pending response from the issue requestor label Sep 25, 2024
@ruisebas
Copy link
Member

I replicated your setup and was still able to upload successfully calling
AWSS3TransferUtility.default().uploadData(_:bucket:key:contentType:expression:completionHandler:).

Some follow up questions:

  • Which Xcode version are you using?
  • Which iOS version are you building to?

Also, could you please share the full callsite to see what parameters you're including? Or alternatively, if you're able, a sample app project that reproduces the issue.

Thanks!

@VijayInnovana
Copy link
Author

Xcode version = version 16.0 (Current)
When we upload last app that have a issue, that time Xcode version 15.2
iOS Version = Any iOS version, not specific (iOS 17 or iOS 18)

When I am downgrade the pods from 2.37.1 to 2.36.7 without any app code changed, its working fine with latest Xcode and iOS version.

@github-actions github-actions bot added pending-maintainer-response Issue is pending response from an Amplify team member and removed pending-community-response Issue is pending response from the issue requestor labels Sep 26, 2024
@ruisebas ruisebas added pending-community-response Issue is pending response from the issue requestor and removed pending-maintainer-response Issue is pending response from an Amplify team member labels Sep 26, 2024
@VijayInnovana
Copy link
Author

Hi @ruisebas,
Any update on this issue, because I not update latest pods of AWSS3 for iOS app with that issue.

@github-actions github-actions bot added pending-maintainer-response Issue is pending response from an Amplify team member and removed pending-community-response Issue is pending response from the issue requestor labels Sep 30, 2024
@ruisebas
Copy link
Member

ruisebas commented Sep 30, 2024

Hi @VijayInnovana, we're not able to reproduce this issue on our side.

To better assist you, please provide the following as previously requested:

  • Verbose logs when you attempt to upload
  • Code snippets showing your full callsite, or a sample app that reproduces the issue

Thanks.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Sep 30, 2024
@ruisebas ruisebas added the pending-community-response Issue is pending response from the issue requestor label Sep 30, 2024
@VijayInnovana
Copy link
Author

hi @ruisebas,

Below added sample project and log files for both versions (2.37.2 and 2.36.7)

"AWS_2.36.7-Version_success_logs" this is successfully uploaded file on S3 server with 2.36.7 version.
"AWS_2.37.2-Version_error_logs" this is error log file while uploaded file on S3 server with 2.37.2 version.

AWSSample.zip
AWS_2.36.7-Version_success_logs.txt
AWS_2.37.2-Version_error_logs.txt

Please let me know if you need any other informations.

@github-actions github-actions bot added pending-maintainer-response Issue is pending response from an Amplify team member and removed pending-community-response Issue is pending response from the issue requestor labels Oct 1, 2024
@ruisebas
Copy link
Member

ruisebas commented Oct 1, 2024

Hi @VijayInnovana, thanks a lot for the information.

Based on the logs, I could see that version 2.37.2 is generating a presigned URL pointing to a bucket in the ap-southeast-5 region, while version 2.36.7 points to ap-south-1, which is the correct one.

I was able to reproduce the issue using the sample app you provided, and I found the root cause: You have manually implemented a mechanism to transform a String into the required AWSRegionType enum, based on hardcoding the existing region's rawValues.

Version 2.37.0 added support for the new ap-southeast-5 region, which has "shifted" some of the internal rawValues by 1, causing your custom function to become outdated. So the Int value that used to be associated with ap-south-1 now is associated with ap-southeast-5.

We regularly add new supported regions to the SDK, so this manual approach is not recommended.
Instead, you can just use the NSString.aws_regionTypeValue() function we provide:

let awsAccessRegion: NSString = "ap-south-1" // i.e. your region
let configuration = AWSServiceConfiguration(
    region: awsAccessRegion.aws_regionTypeValue(),
    credentialsProvider: credentialsProvider
)
AWSServiceManager.default().defaultServiceConfiguration = configuration

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Oct 1, 2024
@ruisebas ruisebas removed the bug Something isn't working label Oct 1, 2024
@ruisebas ruisebas added question General question pending-community-response Issue is pending response from the issue requestor labels Oct 1, 2024
@VijayInnovana
Copy link
Author

Thanks for the information @ruisebas, As you suggested now my issue is resolved.

@github-actions github-actions bot added pending-maintainer-response Issue is pending response from an Amplify team member and removed pending-community-response Issue is pending response from the issue requestor labels Oct 3, 2024
@ruisebas
Copy link
Member

ruisebas commented Oct 3, 2024

Great to hear that! I'm closing this issue then.
Please let us know if you experience any other problem.

@ruisebas ruisebas closed this as completed Oct 3, 2024
@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Oct 3, 2024
Copy link

github-actions bot commented Oct 3, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question General question s3 Issues related to S3
Projects
None yet
Development

No branches or pull requests

2 participants