fastlane: Deliver fails with "Unexpected Error" after uploading package to iTunes Connect

New Issue Checklist

Issue Description

Deliver fails with “Unexpected Error” after uploading package to iTunes Connect It happened three time with three different apps after the last deliver update (v1.41.1)

Complete output when running fastlane, including the stack trace and command used
[14:10:07]: ---------------------
[14:10:07]: --- Step: deliver ---
[14:10:07]: ---------------------
[14:10:07]: Login to iTunes Connect (XXXXXXXXXXX)
[14:10:10]: Login successful

+--------------------------------------------------------------------+-----------------------------+
|                                      deliver 1.14.1 Summary                                      |
+--------------------------------------------------------------------+-----------------------------+
| force                                                              | true                        |
| submit_for_review                                                  | true                        |
| automatic_release                                                  | true                        |
| metadata_path                                                      | ./fastlane/metadata         |
| screenshots_path                                                   | ./calabash_screenshots      |
| app_icon                                                           | ./fastlane/../Framework/... |
| app_version                                                        | 1.2                         |
| release_notes.default                                              | Bug fixes. General stabi... |
| app_review_information.first_name                                  | XXXXXXX                     |
| app_review_information.last_name                                   | XXXXXXX                     |
| app_review_information.phone_number                                | XXXXXXXXXXXXXXXX            |
| app_review_information.email_address                               | XXXXXXXXXXXXXXXXXXXXXXXXXXX |
| app_review_information.notes                                       | XXXXXXXXXXXXXXXXXXXXXXXXXXX |
| price_tier                                                         | 0                           |
| copyright                                                          | XXXXXXXXXXXXXXX             |
| app_rating_config_path                                             | ./fastlane/./ratings.json   |
| submission_information.add_id_info_uses_idfa                       | false                       |
| submission_information.export_compliance_uses_encryption           | false                       |
| submission_information.export_compliance_encryption_updated        | false                       |
| submission_information.content_rights_contains_third_party_content | false                       |
| ipa                                                                | /Users/Shared/Jenkins/Ho... |
| username                                                           | XXXXXXXXXXXXXXXXXXXXXX      |
| app_identifier                                                     | XXXXXXXXXXXXXXXXXXXXXXXXX   |
| skip_binary_upload                                                 | false                       |
| skip_screenshots                                                   | false                       |
| skip_metadata                                                      | false                       |
+--------------------------------------------------------------------+-----------------------------+

[14:10:13]: Making sure the latest version on iTunes Connect matches '1.2' from the ipa file...
[14:10:14]: '1.2' is the latest version on iTunes Connect
[14:10:14]: Loading './fastlane/metadata/en-GB/description.txt'...
[14:10:14]: Loading './fastlane/metadata/en-GB/keywords.txt'...
[14:10:14]: Loading './fastlane/metadata/en-GB/release_notes.txt'...
[14:10:14]: Loading './fastlane/metadata/en-GB/support_url.txt'...
[14:10:14]: Loading './fastlane/metadata/en-GB/privacy_url.txt'...
[14:10:14]: Loading './fastlane/metadata/primary_category.txt'...
[14:10:14]: Loading './fastlane/metadata/secondary_category.txt'...
[14:10:14]: Detected languages: ["en-GB", "default"]
[14:10:15]: Activating language en-GB...
[14:10:17]: Uploading metadata to iTunes Connect
[14:10:18]: Successfully uploaded initial set of metadata to iTunes Connect
[14:10:19]: Starting with the upload of screenshots...
[14:10:19]: Uploading 5 screenshots for language en-GB
[14:10:19]: Uploading './calabash_screenshots/en-GB/iPhone6Plus_screenshot_0.png'...
[14:10:23]: Uploading './calabash_screenshots/en-GB/iPhone6Plus_screenshot_1.png'...
[14:10:26]: Uploading './calabash_screenshots/en-GB/iPhone6Plus_screenshot_2.png'...
[14:10:32]: Uploading './calabash_screenshots/en-GB/iPhone6Plus_screenshot_3.png'...
[14:10:34]: Uploading './calabash_screenshots/en-GB/iPhone6Plus_screenshot_4.png'...
[14:10:40]: Saving changes
[14:10:43]: Successfully uploaded screenshots to iTunes Connect
[14:10:44]: Price Tier unchanged (tier 0)
[14:10:45]: Uploading app icon...
[14:10:48]: Uploading binary to iTunes Connect
[14:10:49]: Going to upload updated app to iTunes Connect
[14:10:49]: This might take a few minutes. Please don't interrupt the script.
[14:11:38]: iTunes Transporter successfully finished its job
[14:11:38]: ------------------------------------------------------------------------------------------------------
[14:11:38]: Successfully uploaded package to iTunes Connect. It might take a few minutes until it's visible online.
[14:11:38]: ------------------------------------------------------------------------------------------------------
[14:11:38]: Finished the upload to iTunes Connect
[14:11:41]: -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[14:11:41]: Variable Dump:
[14:11:41]: {:PLATFORM_NAME=>nil, :LANE_NAME=>"deploy", :BUILD_NUMBER=>"There does not seem to be a CURRENT_PROJECT_VERSION key set for this project.  Add this key to your target's expert build settings.", :PRODUCE_APPLE_ID=>"1151383393", :CERT_FILE_PATH=>"/Users/Shared/Jenkins/Home/workspace/iOS Build - Complete Release/iOS/CM68X7BFDE.cer", :CERT_CERTIFICATE_ID=>"CM68X7BFDE", :SIGH_PROFILE_PATH=>"/Users/Shared/Jenkins/Home/workspace/iOS Build - Complete Release/iOS/AppStore_com.XXXXXXXX.XXXXXXXX.mobileprovision", :SIGH_PROFILE_PATHS=>["/Users/Shared/Jenkins/Home/workspace/iOS Build - Complete Release/iOS/AppStore_com.XXXXXXXX.XXXXXXXXX.mobileprovision"], :SIGH_UDID=>"XXXXXXX-XXXXX-XXXXXX-XXXXX-XXXXXXX", :SIGH_PROFILE_TYPE=>"app-store", :IPA_OUTPUT_PATH=>"/Users/Shared/Jenkins/Home/workspace/iOS Build - Complete Release/iOS/XXXXXXX.ipa", :DSYM_OUTPUT_PATH=>"/Users/Shared/Jenkins/Home/workspace/iOS Build - Complete Release/iOS/XXXXXXXXXX.app.dSYM.zip", :XCODEBUILD_ARCHIVE=>"/Users/Shared/Jenkins/Library/Developer/Xcode/Archives/2016-10-07/Framework 2016-10-07 14.08.45.xcarchive"}
[14:11:41]: {"data"=>nil, "messages"=>{"warn"=>nil, "error"=>["Unexpected Error"], "info"=>nil}, "statusCode"=>"ERROR"}

+------+---------------------------------------------------------------+-------------+
|                                  fastlane summary                                  |
+------+---------------------------------------------------------------+-------------+
| Step | Action                                                        | Time (in s) |
+------+---------------------------------------------------------------+-------------+
| 1    | Verifying required fastlane version                           | 0           |
| 2    | team_id                                                       | 0           |
| 3    | increment_build_number                                        | 0           |
| 4    | produce                                                       | 13          |
| 5    | cert                                                          | 62          |
| 6    | sigh                                                          | 43          |
| 7    | git -C .. apply fastlane/stopAskLocation.patch                | 0           |
| 8    | git -C .. apply -R fastlane/stopAskLocation.patch             | 0           |
| 9    | open afp://admin:AIp4ssw0rd@buildservershost.private/Shared   | 0           |
| 10   | [ -d /Volumes/Shared/Dropbox\ \(AppInstitute\)/AppInstitute\  | 0           |
| 11   | cp ../AppStore_com.* /Volumes/Shared/Dropbox\ \(AppInstitute\ | 0           |
| 12   | cp ../*.mobileprovision /Volumes/Shared/Dropbox\ \(AppInstitu | 0           |
| 13   | cp production_* /Volumes/Shared/Dropbox\ \(AppInstitute\)/App | 0           |
| 14   | update_project_code_signing                                   | 0           |
| 15   | gym                                                           | 84          |
| 💥    | deliver                                                      | 94          |
+------+---------------------------------------------------------------+-------------+

[14:11:42]: fastlane finished with errors```

### Configuration Files

Please copy the complete content of your `Fastfile` and any other configuration files you use below:

Fastfile:
```ruby
fastlane_version "1.105.0"

team_id "XXXXXXXXXXX"
ENV["FASTLANE_ITC_TEAM_ID"] = "XXXXXXXXX"


lane :deploy do |options|
  increment_build_number( build_number: "4447" )
  produce({
        app_name: "XXXXXXX",
        language: "UK English",
        app_version: "1.2",
        sku: "XXXXXXXX",
    team_name: "XXXXXXX Ltd"
  })
  cert

  sigh( force: true )

  ENV["SNAPSHOT_SKIP_OPEN_SUMMARY"] = "1"
  sh "git -C .. apply fastlane/stopAskLocation.patch"

  sh "git -C .. apply -R fastlane/stopAskLocation.patch"


  update_project_code_signing( path: "Framework.xcodeproj")

  ENV["FASTLANE_XCODE_LIST_TIMEOUT"]="120"
  gym(
    scheme: "Framework",
  )
  ENV["DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS"] = "-t Aspera,Signiant,DAV -m diagnostic"
  deliver( 
    force: true,
    submit_for_review: options[:submit],
    automatic_release: options[:release],
    metadata_path: "./fastlane/metadata"
  )
end

Deliverfile:

screenshots_path "./calabash_screenshots"

basePath = "./fastlane/"
app_icon basePath + "../Framework/Resources/Images.xcassets/AppIcon.appiconset/icon_1024.png"

app ENV["PRODUCE_APPLE_ID"]
app_version '1.2' # you can pass this if you want to verify the version number with the ipa file

release_notes({
  'default' => 'Bug fixes. General stability updates.'
})

release_notes({
'default' => 'Bug fixes. General stability updates.'
})
app_review_information({
  first_name: ENV['BUILD_USER_FIRST_NAME'],
  last_name: ENV['BUILD_USER_LAST_NAME'],
  phone_number: "XXXXXXXXXXX",
  email_address: ENV['BUILD_USER_EMAIL'],
  notes: "The 'Listen Now' tab allows the user to play music from an audio stream hosted on the internet (http://XX.XX.XX.XX:8040/listen.pls).

Push notifications are used to:
* inform users when updates are available
* respond to forms submitted via the app
* notify a user when they receive any new messages from the Message Centre within the app
* send users notifications, user specific opt in offers, and loyalty points when they are in a specific physical location (geo-fencing), which requires access to the phone's GPS location

"
})

price_tier 0
copyright "#{Time.now.year} XXXXXXXXX"

app_rating_config_path basePath + "./ratings.json"

submission_information({
    add_id_info_uses_idfa: false,
    export_compliance_uses_encryption: false,
    export_compliance_encryption_updated: false,
    content_rights_contains_third_party_content: false
})


ipa ENV["IPA_OUTPUT_PATH"]

Environment

Jenkins version 2.7.2 MacOS X version 10.11.3 fastlane version 1.105.0 Do you use bundler to execute fastlane (i.e. bundle exec fastlane)? NO Do you use a Ruby environment manager (e.g. chruby, rbenv, rvm)? NO

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 51 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Hey everyone, thanks for all the reports, and sorry it took so long. Thanks to @sunboshan, it was easy to reproduce the issue and provide a fix. I’ve just pushed https://github.com/fastlane/fastlane/pull/6652, which we’ll merge and release as soon as possible 🚀

We’ll update this GitHub issue once the new version is live ✨

spaceship 0.36.1 has been shipped which resolves this issue. You can update to it by running: gem update spaceship. Please let us know if this resolves this issue for you. 👍

Hi everyone!

We are going to hold off on trying to write a fix/workaround for this for the time being as this is something that is happening on Apple’s end (given that they are displaying 500’s on the web) and we expect them to fix it in the not-so-distant future.

In the mean time, we would encourage you to submit issues to iTunesConnect’s support center with reports that this happens even when uploading via the web UI.

I put together a ruby script that uses Spaceship to finish submitting an app for review if the deliver fails right after upload as it seems to for most of us. https://gist.github.com/zineer/17a516aeebc16cd731190f26184d01e2 You’ll need to make at least a few tweaks to match your purposes including

  • replace your email into line 56
  • change the submission properties on lines 73-87 to match your submission_information from your Deliverfile

Then you can chmod +x finishfailed.rb, and run it like ./finishfailed com.domain.app

It is based on https://github.com/fastlane/fastlane/blob/master/deliver/lib/deliver/submit_for_review.rb but for getting the app and edit_version it catches the exception caused by the 500 error and loops until the error goes away, then continues with the submission.

deliver 1.14.3 has been released with the fix! 🚀

@nmonasterio the checksum should be based on the binary of the image file(not 100% sure though). Yet you don’t need to get those information by yourself. After upload the image by sending POST request to https://du-itc.itunes.apple.com/upload/image, you will get response like this:

{
  "token" : "Purple71/v4/4e/3c/f1/4e3cf119-13a0-65b3-f7f2-f7cb824cb0d8/pr_source.png",
  "tokenType" : "AssetToken",
  "type" : "MZLargeApplicationIconType.SOURCE",
  "width" : 1024,
  "height" : 1024,
  "hasAlpha" : false,
  "length" : 61037,
  "md5" : "d41d8ed98f00b204e9800998ecf8427e"
}

@KrauseFx already has the fix for screenshot files in #6423, need to do similar fix for icon files. This has been tested for bunch of apps, providing assetToken, originalFileName, size, width, height and checksum will fix the 500 error.

For the moment I applied this inelegant change to the SubmitForReview class in deliver/submit_for_review.rb

    def submit!(options)
      app = options[:app]
      ####### here starts the change #######
      # set a timer
      start = Time.now
      UI.message("Trying to select the build...")
      # start a loop to try multiple times
      loop do
        begin
          select_build(options)
          # if select_build doesn't return any error break and continue normally
          break
        rescue
          # if select_build fails output a message and retry after 60 secs 
          UI.message("")
          UI.message("Trying again...")
          if (Time.now - start) > (60 * 2)
            UI.message("#{((Time.now - start) / 60).round} minutes passed...")
          end
          # if still failing after 20 minutes will abort
          if (Time.now - start) > (60 * 20)
            UI.message("it's taking too long!")
            UI.message("Aborting.")
            raise "Error while trying to select the build in iTunesConnect."
          end
          sleep 60
        end
      end
      ####### here ends the change #######

      UI.message("Submitting the app for review...")
      submission = app.create_submission

      # Set app submission information
      # Default Values
      submission.content_rights_contains_third_party_content = false
      submission.content_rights_has_rights = true
      submission.add_id_info_uses_idfa = false

      # User Values
      if options[:submission_information]
        options[:submission_information].each do |key, value|
          UI.message("Setting '#{key}' to '#{value}'...")
          submission.send("#{key}=", value)
        end
      end

      # Finalize app submission
      submission.complete!

      UI.success("Successfully submitted the app for review!")
    end

it’s based on @zineer script concept, but applied directly to deliver source code

@ohwutup waiting for a better solution from your side I want to let you know that trying this with four apps the average waiting time has been 5 minutes before deliver was able to select the build and exit the loop. After that everything worked properly

Just started seeing the same error as well, starting yesterday. We were able to deploy some 20 apps with no issue Thursday afternoon, with submission for review and everything.

Thursday night/Friday morning, we were able to upload but started getting Unexpected Errors on submission for review. Starting in the afternoon, we were seeing the same error as yours upon upload.

Just verified, and it’s still there.

Relevant portion of our stack trace (seeing this both in Jenkins and on a local release):

/Users/nmonasterio/.rvm/gems/ruby-2.2.3/gems/spaceship-0.34.3/lib/spaceship/client.rb:453:in `parse_response': [!] {"data"=>nil, "messages"=>{"warn"=>nil, "error"=>["Unexpected Error"], "info"=>nil}, "statusCode"=>"ERROR"} (Spaceship::Client::UnexpectedResponse)
    from /Users/nmonasterio/.rvm/gems/ruby-2.2.3/gems/spaceship-0.34.3/lib/spaceship/tunes/tunes_client.rb:299:in `app_version'
    from /Users/nmonasterio/.rvm/gems/ruby-2.2.3/gems/spaceship-0.34.3/lib/spaceship/tunes/app_version.rb:174:in `find'
    from /Users/nmonasterio/.rvm/gems/ruby-2.2.3/gems/spaceship-0.34.3/lib/spaceship/tunes/application.rb:102:in `edit_version'
    from /Users/nmonasterio/.rvm/gems/ruby-2.2.3/gems/deliver-1.14.1/lib/deliver/submit_for_review.rb:32:in `select_build'
    from /Users/nmonasterio/.rvm/gems/ruby-2.2.3/gems/deliver-1.14.1/lib/deliver/submit_for_review.rb:5:in `submit!'
    from /Users/nmonasterio/.rvm/gems/ruby-2.2.3/gems/deliver-1.14.1/lib/deliver/runner.rb:87:in `submit_for_review'
    from /Users/nmonasterio/.rvm/gems/ruby-2.2.3/gems/deliver-1.14.1/lib/deliver/runner.rb:30:in `run'
    from /Users/nmonasterio/.rvm/gems/ruby-2.2.3/gems/deliver-1.14.1/lib/deliver/commands_generator.rb:

Can confirm it works here.

Op 21 okt. 2016, om 20:13 heeft Andrea Falcone notifications@github.com het volgende geschreven:

spaceship 0.36.1 has been shipped which resolves this issue. You can update to it by running: gem update spaceship. Please let us know if this resolves this issue for you. 👍

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fastlane/fastlane/issues/6455#issuecomment-255436110, or mute the thread https://github.com/notifications/unsubscribe-auth/ABjMuKGjPt8BTMiXZTkaL8ceUMFJbLInks5q2QDigaJpZM4KREpL.

Thank you for the insight, @sunboshan . I can confirm that by leaving out the app_icon option from deliver the submission succeeds without any errors. Would be great if this could get fixed.

ITC returns 500 when uploading an icon and save.

The JSON for icon looks like this:

"largeAppIcon": {
        "value": {
            "assetToken": "Purple71/v4/cd/f9/f6/cdf9f60d-8c39-4c29-e5b4-c49a664714ad/pr_source.png",
            "sortOrder": null,
            "type": null,
            "size": 80012,
            "width": 1024,
            "height": 1024,
            "checksum": 1e120bf7347d0ddac785fd45c1da0e6d,
            "originalFileName": "icon.png"
        }
    }

Before Apple made change to ITC, we only need to change assetToken and originalFileName part, leave the rest nil. But after Apple made the change, it will cause 500 error.

The solution is simply provide assetToken, originalFileName, size, width, height and checksum in the JSON. It will work. Leave the fix for @KrauseFx

It should fix #6425 as well.

@dbalas thanks for your comment. It seems the problem is in the ‘submission_information’

I used to have

submission_information({
    add_id_info_uses_idfa: false,
    export_compliance_uses_encryption: false,
    export_compliance_encryption_updated: false,
    content_rights_contains_third_party_content: false
})

I noticed that I should only keep one of the two export_compliance_uses_encryption OR export_compliance_encryption_updated depending on the app being submitted for the first time or updated

Even if the previous settings have been working for a long time, it seems now something changed.