soto-project / soto

Swift SDK for AWS that works on Linux, macOS and iOS
https://soto.codes
Apache License 2.0
878 stars 83 forks source link

Multiple fails uploads from Network lost issues causing CredentialProviderError.noProvider error to be thrown #661

Closed YoavGro closed 1 year ago

YoavGro commented 1 year ago

Describe the bug A clear and concise description of what the bug is. If you can include a link to redacted requests or responses, that would be very helpful as well!

To Reproduce Steps to reproduce the behavior:

  1. have multiple uploads in a queue
  2. start uploading
  3. Turn off connection for a very low connection
  4. Wait for 30 seconds
  5. Turn connection on
  6. All upload calls to multipartUpload( throws an error with CredentialProviderError.noProvider

Expected behavior

Setup (please complete the following information):

Additional context

After app restart uploads continue regularly

adam-fowler commented 1 year ago

Hi, a couple of questions

YoavGro commented 1 year ago

Hi

adam-fowler commented 1 year ago

Where are you getting your identityPoolId from? Any chance this could have expired? Could you post the code that is doing the upload?

Also if you put a break point here https://github.com/soto-project/soto/blob/eda662e974ab718a1932c3e4f3f0d63d2024b67b/Sources/Soto/Extensions/CognitoIdentity/CognitoIdentity%2BCredentialProvider.swift#L54 do you hit it and then if so what is the contents of response when you do?

YoavGro commented 1 year ago
 public func uploadRecordingSegment(fileName: String, segmentLocalPath: String) async throws {
        let bucket = InjectedValues[\.enviromentService].selectedEnvironment.awsBucket
        let request = S3.CreateMultipartUploadRequest(bucket: bucket, key: fileName)
        _ = try await self._s3.multipartUpload(request, filename: segmentLocalPath)
    }
YoavGro commented 1 year ago

I'm seeing this error, only after we are getting timeouts on multiple parts

adam-fowler commented 1 year ago

Yeah I hit this throw and the error response on my catch is SotoCore.CredentialProviderError._CredentialProviderError.noProvider

By response I meant the contents of the response variable in the same function that throws the error. It appears AWS is returning an empty response when I ask it for credentials from your identity.

YoavGro commented 1 year ago

Ohh got it, sorry guess I misunderstood that. Checked it now, and it looks like it is not throwing the error from this line

adam-fowler commented 1 year ago

Hmm not totally sure where that noProvider error is coming from. There is only two places which throw it and given the description of the bug I cannot see how either are reached. Here are some options to play with

adam-fowler commented 1 year ago

Closing as I did not get a response