You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DNCoding opened this issue
Jun 3, 2021
· 2 comments
Labels
bugSomething isn't workingduplicateThis issue or pull request already existsfollow upRequires follow up from maintainersstorageIssues related to the Storage category
My app upload files to S3 for every 15 min. When application is in foreground, the files get uploaded properly. But when app went to background, the upload is too slow and keep throwing error. after so many retry, one file get uploaded successfully.
I keep getting any one of this 3 error
Error 1:
StorageError: Unexpected error occurred with message: Domain: [NSURLErrorDomain
Code: [-1001
LocalizedDescription: [The operation couldn’t be completed. (NSURLErrorDomain error -1001.)
LocalizedFailureReason: [
LocalizedRecoverySuggestion: [
Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at:
file: /.../SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 63
Error 2:
StorageError: Unexpected error occurred with message: Domain: [Amplify.AuthError
Code: [1
LocalizedDescription: [The operation couldn’t be completed. (Amplify.AuthError error 1.)
LocalizedFailureReason: [
LocalizedRecoverySuggestion: [
Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at:
file: /.../SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 63
Error 3:
StorageError: A network error occured while trying to fetch identity id
Recovery suggestion: Try again with exponential backoff
Caused by:
AuthError: A network error occured while trying to fetch identity id
Recovery suggestion: Try again with exponential backoff
Caused by:
network
Code:
�
In AmplifyMgr:
/** Sign In User using Cognito auth before uploading the file **/
func signIn (username: String, password: String) {
Amplify.Auth.signIn(username: username, password: password) { result in
switch result {
case .success(let signInResult):
if case .done = signInResult.nextStep {
print("\(#function): Sign in succeeded")
self.getUserToken()
}
else {
self.processSignInNextStep(username: username, nextStep: signInResult.nextStep)
}
case .failure(let error):
let errMsg = "Sign in failed - \(error)"
print("\(#function): \(errMsg)")
self.signedInError(errorMsg: errMsg)
}
}
}
func uploadFile (_ fileUrl: URL) {
Amplify.Storage.uploadFile (key: fileUrl.lastPathComponent,
local: fileUrl,
resultListener: { event in
switch event {
case .success(let data):
print("\(#function): \(fileUrl.lastPathComponent) is uploaded - \(data)")
self.uploadCompletionHandler(fileUrl)
case .failure(let storageError):
print("\(#function): Error uploading file \(fileUrl.lastPathComponent) - \(storageError)")
self.uploadErrorHandler(fileUrl)
}
DispatchQueue.main.async {
if (nil != self.backgroundURLCompletionHandler) {
print("\(#function): Background URL Session Completion Handler Called")
self.backgroundURLCompletionHandler!()
self.backgroundURLCompletionHandler = nil
}
}
}
)
print("\(#function): Upload called")
}
This seems to be related to token expiry once the download task is handed off to iOS. In that case, this behavior is expected. Possible remedy would be to rework the way we manage URL tasks and cancel/re-submit a task once the token is expired
We still don't have a good story for long-running transfers. If a single transfer takes longer than 1 hour to complete, it will fail unless the customer is using static credentials to create the presigned URL. This is covered under an existing feature request.
We fix/enhance the error message for the error cases relating to auth token expiry for background tasks
Based on these items, the next steps are:
Investigate to validate the above assumptions
Add a new issue to improve error messaging
Close this issue as a dupe of the open feature request for long-running transfers
bugSomething isn't workingduplicateThis issue or pull request already existsfollow upRequires follow up from maintainersstorageIssues related to the Storage category
My app upload files to S3 for every 15 min. When application is in foreground, the files get uploaded properly. But when app went to background, the upload is too slow and keep throwing error. after so many retry, one file get uploaded successfully.
I keep getting any one of this 3 error
Error 1:
StorageError: Unexpected error occurred with message: Domain: [NSURLErrorDomain
Code: [-1001
LocalizedDescription: [The operation couldn’t be completed. (NSURLErrorDomain error -1001.)
LocalizedFailureReason: [
LocalizedRecoverySuggestion: [
Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at:
file: /.../SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 63
Error 2:
StorageError: Unexpected error occurred with message: Domain: [Amplify.AuthError
Code: [1
LocalizedDescription: [The operation couldn’t be completed. (Amplify.AuthError error 1.)
LocalizedFailureReason: [
LocalizedRecoverySuggestion: [
Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at:
file: /.../SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 63
Error 3:
StorageError: A network error occured while trying to fetch identity id
Recovery suggestion: Try again with exponential backoff
Caused by:
AuthError: A network error occured while trying to fetch identity id
Recovery suggestion: Try again with exponential backoff
Caused by:
network
Code:
�
In AmplifyMgr:
/** Sign In User using Cognito auth before uploading the file **/
In AppDelegate:
I have used swift package of Amplify for my project, other settings are done as per the getting started documentation.
The text was updated successfully, but these errors were encountered: