Closed greater-c closed 4 months ago
@greater-c Thanks for submitting the issue. We'll investigate the issue and provide updates here.
@greater-c Can you provide the code that demonstrates how you're upload to S3 for reference and help us reproduce your issue.
@greater-c Can you also verify if you have the file awsconfiguration.json
is your project?
@greater-c Can you also verify if you have the file
awsconfiguration.json
is your project?
I have not created that file, is it not in use and it's not in my Xcode project.
@greater-c Can you provide the code that demonstrates how you're upload to S3 for reference and help us reproduce your issue.
I've provided the code. It failed to upload files until I created a bucket in the us-east-1 region and set it as the upload target.
@greater-c I was able to upload to us-west-1
without any issues based on the provided code sample:
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USWest1, identityPoolId: "us-west-1:xxxx-xxx-xxxx")
let configuration = AWSServiceConfiguration(region: .USWest1, credentialsProvider: credentialProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
let transferUtility = AWSS3TransferUtility.default()
Here are couple things to try to debug further on why it's not working for you:
amplifyconfiguration.json
or awsconfiguration.json
AWSServiceManager.default().defaultServiceConfiguration
more than once since the documentation says that it's a one-time setter
https://github.com/aws-amplify/aws-sdk-ios/blob/main/AWSCore/Service/AWSService.h#L71-L73transferUtility.uploadData(data,
bucket: "testbucket",
key: "testkey",
contentType: "application/octet-stream",
expression: nil,
completionHandler: { (task, error) in
if let error = error {
print("*** Error: \(error.localizedDescription)")
}
})
The SDK automatically signs server requests with the us-east-1 region for some reason. I've been dealing with this issue for days and needed server logs to discover this.
Code:
func uploadMP4ToS3(filePath: URL, key: String) { let credentialsProvider = AWSCognitoCredentialsProvider(regionType: .USWest2, identityPoolId: "US-WEST-2 IDENTITY_POOL_ID") // Set up the service configuration let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialsProvider)