Skip to content

File upload failing in background #3876

Open
@amruth-movano

Description

@amruth-movano

Describe the bug

Hi Team,
We have application which connection with BLE device and for each min it syncs data and as soon as sync completes it uploads the file to s3 for that particular sync.

So we are observing failure in files when app is in background overnight which is causing UI to hang when user come to foreground in the morning.

Please see logs attached

Steps To Reproduce

Upload log file for each min in background overnight

Expected behavior

All File should get upload

Amplify Framework Version

2.39.0

Amplify Categories

Storage

Dependency manager

Swift PM

Swift version

5.9.2

CLI version

12.11.1

Xcode version

15.2

Relevant log output

2024/09/19 15:07:04:798  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log, error: StorageError: The HTTP response status code is [503].
Recovery suggestion: Server error.
For more information on HTTP status codes, take a look at
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
2024/09/19 15:07:04:801  Successfully uploaded log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log
2024/09/19 15:07:05:135  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log, error: StorageError: The HTTP response status code is [503].
Recovery suggestion: Server error.
For more information on HTTP status codes, take a look at
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
2024/09/19 15:07:05:143  Successfully uploaded log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log
2024/09/19 15:07:05:146  Successfully uploaded log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log
2024/09/19 15:07:05:175  Successfully uploaded log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log
2024/09/19 15:07:05:189  Successfully uploaded log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log
2024/09/19 15:07:05:295  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log, error: StorageError: The HTTP response status code is [400].
Recovery suggestion: Client error.
For more information on HTTP status codes, take a look at
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
2024/09/19 15:07:05:295  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log, error: StorageError: The HTTP response status code is [400].
Recovery suggestion: Client error.
For more information on HTTP status codes, take a look at
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
2024/09/19 15:07:06:053  Successfully uploaded log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log
2024/09/19 15:07:06:057  Successfully uploaded log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log
2024/09/19 15:07:06:059  Successfully uploaded log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log
2024/09/19 15:07:06:084  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log, error: StorageError: The HTTP response status code is [400].
Recovery suggestion: Client error.
For more information on HTTP status codes, take a look at
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
2024/09/19 15:07:06:091  Successfully uploaded log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log
2024/09/19 15:07:06:128  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--06-14-40-693.log, error: StorageError: Unexpected error occurred with message: Response is not an HTTP response
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: /Users/runner/Library/Developer/Xcode/DerivedData/MovanoRing-fxwtpneshqrfliflkjfdocpebocf/SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 104
Caused by:
Error Domain=NSURLErrorDomain Code=-996 "Could not communicate with background transfer service" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundUploadTask <F76769CF-2E72-432F-A16F-7992885EE371>.<1955>"
), NSLocalizedDescription=Could not communicate with background transfer service, _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <F76769CF-2E72-432F-A16F-7992885EE371>.<1955>}
2024/09/19 15:07:06:131  Get user profile from keychain
2024/09/19 15:07:06:156  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--06-14-40-693.log, error: StorageError: Unexpected error occurred with message: Response is not an HTTP response
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: /Users/runner/Library/Developer/Xcode/DerivedData/MovanoRing-fxwtpneshqrfliflkjfdocpebocf/SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 104
Caused by:
Error Domain=NSURLErrorDomain Code=-996 "Could not communicate with background transfer service" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundUploadTask <CA69D620-A35A-44CE-B738-9EA00788204F>.<1956>"
), NSLocalizedDescription=Could not communicate with background transfer service, _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <CA69D620-A35A-44CE-B738-9EA00788204F>.<1956>}
2024/09/19 15:07:06:169  Get user profile from keychain
2024/09/19 15:07:06:169  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--06-14-40-693.log, error: StorageError: Unexpected error occurred with message: Response is not an HTTP response
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: /Users/runner/Library/Developer/Xcode/DerivedData/MovanoRing-fxwtpneshqrfliflkjfdocpebocf/SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 104
Caused by:
Error Domain=NSURLErrorDomain Code=-996 "Could not communicate with background transfer service" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundUploadTask <CB5E12AF-9E3A-4CA9-9B26-FC96A6C1BA23>.<1957>"
), NSLocalizedDescription=Could not communicate with background transfer service, _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <CB5E12AF-9E3A-4CA9-9B26-FC96A6C1BA23>.<1957>}
2024/09/19 15:07:06:172  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--06-14-40-693.log, error: StorageError: Unexpected error occurred with message: Response is not an HTTP response
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: /Users/runner/Library/Developer/Xcode/DerivedData/MovanoRing-fxwtpneshqrfliflkjfdocpebocf/SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 104
Caused by:
Error Domain=NSURLErrorDomain Code=-996 "Could not communicate with background transfer service" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundUploadTask <9CF73380-8AA8-440E-80B9-E1946ED0B340>.<1958>"
), NSLocalizedDescription=Could not communicate with background transfer service, _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <9CF73380-8AA8-440E-80B9-E1946ED0B340>.<1958>}
2024/09/19 15:07:06:180  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--06-14-40-693.log, error: StorageError: Unexpected error occurred with message: Response is not an HTTP response
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: /Users/runner/Library/Developer/Xcode/DerivedData/MovanoRing-fxwtpneshqrfliflkjfdocpebocf/SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 104
Caused by:
Error Domain=NSURLErrorDomain Code=-996 "Could not communicate with background transfer service" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundUploadTask <6E09EB75-C6F1-4043-B3A4-5F01E08F5932>.<1959>"
), NSLocalizedDescription=Could not communicate with background transfer service, _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <6E09EB75-C6F1-4043-B3A4-5F01E08F5932>.<1959>}
2024/09/19 15:07:06:226  Successfully uploaded log file: com.movano.ios.staging 2024-09-19--14-08-39-830.log
2024/09/19 15:10:30:308  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--06-14-40-693.log, error: StorageError: Unexpected error occurred with message: Response is not an HTTP response
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: /Users/runner/Library/Developer/Xcode/DerivedData/MovanoRing-fxwtpneshqrfliflkjfdocpebocf/SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 104
Caused by:
Error Domain=NSURLErrorDomain Code=-996 "Could not communicate with background transfer service" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundUploadTask <062DC85B-BDA8-44EE-A920-102A4B4A443B>.<1960>"
), NSLocalizedDescription=Could not communicate with background transfer service, _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <062DC85B-BDA8-44EE-A920-102A4B4A443B>.<1960>}
2024/09/19 15:10:30:308  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--06-14-40-693.log, error: StorageError: Unexpected error occurred with message: Response is not an HTTP response
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: /Users/runner/Library/Developer/Xcode/DerivedData/MovanoRing-fxwtpneshqrfliflkjfdocpebocf/SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 104
Caused by:
Error Domain=NSURLErrorDomain Code=-996 "Could not communicate with background transfer service" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundUploadTask <EB392810-F7BE-4F54-8418-64022BDF5A2B>.<1961>"
), NSLocalizedDescription=Could not communicate with background transfer service, _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <EB392810-F7BE-4F54-8418-64022BDF5A2B>.<1961>}
2024/09/19 15:10:30:308  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--06-14-40-693.log, error: StorageError: Unexpected error occurred with message: Response is not an HTTP response
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: /Users/runner/Library/Developer/Xcode/DerivedData/MovanoRing-fxwtpneshqrfliflkjfdocpebocf/SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 104
Caused by:
Error Domain=NSURLErrorDomain Code=-996 "Could not communicate with background transfer service" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundUploadTask <22004E69-441C-461A-99E4-BFD0CD9DE072>.<1963>"
), NSLocalizedDescription=Could not communicate with background transfer service, _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <22004E69-441C-461A-99E4-BFD0CD9DE072>.<1963>}
2024/09/19 15:10:30:308  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--06-14-40-693.log, error: StorageError: Unexpected error occurred with message: Response is not an HTTP response
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: /Users/runner/Library/Developer/Xcode/DerivedData/MovanoRing-fxwtpneshqrfliflkjfdocpebocf/SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 104
Caused by:
Error Domain=NSURLErrorDomain Code=-996 "Could not communicate with background transfer service" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundUploadTask <43651E90-6224-4728-A00F-426ABF90164B>.<1962>"
), NSLocalizedDescription=Could not communicate with background transfer service, _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <43651E90-6224-4728-A00F-426ABF90164B>.<1962>}
2024/09/19 15:10:30:308  Failed to upload or delete log file: com.movano.ios.staging 2024-09-19--06-14-40-693.log, error: StorageError: Unexpected error occurred with message: Response is not an HTTP response
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: /Users/runner/Library/Developer/Xcode/DerivedData/MovanoRing-fxwtpneshqrfliflkjfdocpebocf/SourcePackages/checkouts/amplify-ios/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion
line: 104
Caused by:
Error Domain=NSURLErrorDomain Code=-996 "Could not communicate with background transfer service" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(
    "BackgroundUploadTask <2F8563DC-841C-4EE2-AA51-61E89464A98B>.<1964>"
), NSLocalizedDescription=Could not communicate with background transfer service, _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundUploadTask <2F8563DC-841C-4EE2-AA51-61E89464A98B>.<1964>}

Is this a regression?

Yes

Regression additional context

No response

Platforms

iOS

OS Version

iOS 17.5.1

Device

iPhone 14 Pro

Specific to simulators

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstorageIssues related to the Storage category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions