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

nil transfer utility after successful registration #2962

Closed
lmramirez opened this issue Aug 20, 2020 · 4 comments
Closed

nil transfer utility after successful registration #2962

lmramirez opened this issue Aug 20, 2020 · 4 comments
Assignees
Labels
pending-release Code has been merged but pending release question General question s3 Issues related to S3

Comments

@lmramirez
Copy link

State your question

I have set up my transfer utility like so:

        let credentialProvider = AWSBasicSessionCredentialsProvider(accessKey: uploadCredentials.accessKeyId,
                                                                     secretKey: uploadCredentials.secretAccessKey,
                                                                     sessionToken: uploadCredentials.sessionToken)

        guard let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider) else {
            completion?(.failure(.configurationFailed))
            return
        }
        configuration.sharedContainerIdentifier = config.appGroupId

        AWSS3TransferUtility.register(
            with: configuration,
            transferUtilityConfiguration: defaultTransferUtilityConfiguration,
            forKey: utilityKey
        ) { error in
            if let error = error {
                completion?(.failure(.failedToRegister(error: error)))
                return
            }

            guard let transferUtility = AWSS3TransferUtility.s3TransferUtility(forKey: utilityKey) else {
                // *** This code path should never be hit, but it sometimes is ****
                completion?(.failure(.utilityNotFound))
                return
            }

            let uploadService = VideoFileUploadService(config: config,
                                                       transferUtility: transferUtility,
                                                       videoId: videoId,
                                                       s3Bucket: s3Bucket)

            completion?(.success(uploadService))
        }

I've noticed in my application logs however, that on occasion, the transferUtility is nil. The docs indicate that this should only ever happen when there was an error in the registration, however, we can see that I am checking for the error in the lines preceding the getting of the transfer utility. How is this possible?

Which AWS Services are you utilizing?
S3

Provide code snippets (if applicable)

Environment(please complete the following information):

  • SDK Version: 2.13.4
  • Dependency Manager: cocoapods
  • Swift Version : 5.0

Device Information (please complete the following information):

  • Device: iPhone 10.4, but also many others
  • iOS Version: 13.6
  • Specific to simulators: No
@lmramirez lmramirez changed the title nil transfer utility after successful registration nil transfer utility after successful registration Aug 20, 2020
@ruiguoamz ruiguoamz added the s3 Issues related to S3 label Aug 21, 2020
@palpatim palpatim added the question General question label Oct 2, 2020
@lawmicha
Copy link
Member

Hi @lmramirez, Could you enable verbose logging?

AWSDDLog.sharedInstance.logLevel = .verbose
AWSDDLog.add(AWSDDTTYLogger.sharedInstance)

Do you have any relevant logs to share when it successfully registers but then retrieving it returns nil?

related code

  1. init https://github.com/aws-amplify/aws-sdk-ios/blob/main/AWSS3/AWSS3TransferUtility.m#L389
  2. retrieve for key https://github.com/aws-amplify/aws-sdk-ios/blob/main/AWSS3/AWSS3TransferUtility.m#L331

@lawmicha lawmicha added the pending-community-response Issue is pending response from the issue requestor label Oct 16, 2020
@wooj2
Copy link
Contributor

wooj2 commented Oct 17, 2020

Hi @lmramirez

I chatted with @royjit , and he noticed that the completion block could be called before the execution of registerS3TransferUtilityWithConfiguration:transferUtilityConfiguration:forKeycompletionHandler: completes.

To fix this, I submitted a version here which attempts to address your concern.

@wooj2 wooj2 added work in progress Issues was triaged and investigation done and removed pending-community-response Issue is pending response from the issue requestor labels Oct 17, 2020
@lmramirez
Copy link
Author

@wooj2 thanks for taking a look at this!

@wooj2 wooj2 removed the work in progress Issues was triaged and investigation done label Oct 22, 2020
@wooj2
Copy link
Contributor

wooj2 commented Oct 22, 2020

Hi @lmramirez !

Thanks again for submitting this bug report. I've submitted the code change to main, and should be included as part of our next release. I will be optimistically closing this ticket for now, but feel free to re-open if you have any questions and/or concerns regarding this issue.

Thanks again!

@wooj2 wooj2 closed this as completed Oct 22, 2020
@wooj2 wooj2 added the pending-release Code has been merged but pending release label Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-release Code has been merged but pending release question General question s3 Issues related to S3
Projects
None yet
Development

No branches or pull requests

5 participants