title: Uploading files to s3 and then storing the URL in Firebase - Swift 2.2
body: <p>I want to upload a png file to s3 and then getting the s3 file url to be stored in Firebase json format. The s3 portion works fine, but the Firebase function somehow goes into assembly code and doesn't run. </p>
  
  <p>The message that I get is:</p>
  
  <blockquote>
    <p>Firebase was compiled with optimization - stepping may behave oddly; variables may not be available.</p>
  </blockquote>
  
  <pre><code>func uploadToS3(writePath: NSURL) {
      let ext = "png"
      let uploadRequest = AWSS3TransferManagerUploadRequest()
      uploadRequest.body = writePath
      uploadRequest.key = NSProcessInfo.processInfo().globallyUniqueString + "." + ext
      uploadRequest.bucket = S3BucketName
      self.s3URL = NSURL(string: "http://s3.amazonaws.com/\(S3BucketName)/\(uploadRequest.key!)")!
      uploadRequest.contentType = "image/" + ext
      let transferManager = AWSS3TransferManager.defaultS3TransferManager()
      transferManager.upload(uploadRequest).continueWithBlock { (task) -&gt; AnyObject! in
          if let error = task.error {
              print("Upload failed ❌ (\(error))")
          }
          if let exception = task.exception {
              print("Upload failed ❌ (\(exception))")
          }
          if task.result != nil {
              print("Uploaded to:\n\(self.s3URL)")
              updateFirebase(self.s3URL) **this doesn't run**
          }
          else {
              print("Unexpected empty result.")
          }
          return nil
      }
  }
  func updateFirebase(url: NSURL){
     let ref = self.userRef.childByAppendingPath(self.uid).childByAppendingPath("photos")
     ref.updateChildValues([url.absoluteString: true])
      print("updated firebase")
  }
  </code></pre>
  
  <p>Appreciate any help!</p>