fastlane: Pilot: Forbidden error while waiting for iTunes Connect to process

New Issue Checklist

Issue Description

This happens for me intermittently. While using pilot, the build will successfully upload, but in the waiting process for iTunes connect to process the build, it sometimes errors out with a “Forbidden” error code. Which is odd, because I am using the proper credentials. Again, it’s hit or miss. Perhaps the solution is to make the network code a little bit more robust around these kinds of errors and to retry a few times before terminating.

Complete output when running fastlane, including the stack trace and command used

You can use: --capture_output as the last commandline argument to get that collected for you

[04:14:59]: -------------------
[04:14:59]: --- Step: pilot ---
[04:14:59]: -------------------
[04:14:59]: Login to iTunes Connect (joncursi@gmail.com)
[04:15:01]: Login successful
[04:15:02]: Ready to upload new build to TestFlight (App: 1269377156)...
[04:15:02]: Going to upload updated app to iTunes Connect
[04:15:02]: This might take a few minutes. Please don't interrupt the script.
[04:19:07]: iTunes Transporter successfully finished its job
[04:19:07]: --------------------------------------------------------------
[04:19:07]: Successfully uploaded package to iTunes Connect. It might take a few minutes until it's visible online.
[04:19:07]: --------------------------------------------------------------
[04:19:07]: Successfully uploaded the new binary to iTunes Connect
[04:19:07]: If you want to skip waiting for the processing to be finished, use the `skip_waiting_for_build_processing` option
[04:19:31]: Waiting for iTunes Connect to finish processing the new build (2.0.8 - 119)
[04:20:02]: Waiting for iTunes Connect to finish processing the new build (2.0.8 - 119)
[04:20:32]: Waiting for iTunes Connect to finish processing the new build (2.0.8 - 119)
[04:21:06]: -------------------
[04:21:06]: --- Step: slack ---
[04:21:06]: -------------------
[04:21:07]: Successfully sent Slack notification
+-----------------------------------+-----------------------------------+
|                             Lane Context                              |
+-----------------------------------+-----------------------------------+
| PLATFORM_NAME                     | ios                               |
| LANE_NAME                         | ios beta                          |
| FL_CHANGELOG                      |                                   |
| VERSION_NUMBER                    | 2.0.8                             |
| LATEST_BUILD_NUMBER               | 118                               |
| LATEST_TESTFLIGHT_BUILD_NUMBER    | 118                               |
| BUILD_NUMBER                      | 119                               |
| SIGH_PROFILE_TYPE                 | app-store                         |
| MATCH_PROVISIONING_PROFILE_MAPPI  | {"com.cheddur"=>"match AppStore   |
| NG                                | com.cheddur"}                     |
| IPA_OUTPUT_PATH                   | /Users/joncursi/Sites/joncursi/r  |
|                                   | edbird-native/fastlane/build/red  |
|                                   | birdNative.ipa                    |
| DSYM_OUTPUT_PATH                  | /Users/joncursi/Sites/joncursi/r  |
|                                   | edbird-native/fastlane/build/red  |
|                                   | birdNative.app.dSYM.zip           |
| XCODEBUILD_ARCHIVE                | ./fastlane/build.xcarchive        |
+-----------------------------------+-----------------------------------+
[04:21:07]: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 403 </title>
</head>
<body>
<h2>HTTP ERROR: 403</h2>
<p>Problem accessing /v2/providers/118238965/apps/1269377156/platforms/ios/trains/2.0.8/builds. Reason:
<pre>    Forbidden</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>


+------+----------------------+-------------+
|             fastlane summary              |
+------+----------------------+-------------+
| Step | Action               | Time (in s) |
+------+----------------------+-------------+
| 1    | update_fastlane      | 3           |
| 2    | Verifying required   | 0           |
|      | fastlane version     |             |
| 3    | Verifying required   | 0           |
|      | ruby version         |             |
| 4    | ensure_git_branch    | 0           |
| 5    | prompt               | 1           |
| 6    | changelog_from_git_  | 0           |
|      | commits              |             |
| 7    | bundle_install       | 0           |
| 8    | ensure_xcode_versio  | 0           |
|      | n                    |             |
| 9    | clear_derived_data   | 0           |
| 10   | increment_version_n  | 1           |
|      | umber                |             |
| 11   | latest_testflight_b  | 35          |
|      | uild_number          |             |
| 12   | increment_build_num  | 0           |
|      | ber                  |             |
| 13   | commit_version_bump  | 0           |
| 14   | push_to_git_remote   | 4           |
| 15   | match                | 10          |
| 16   | add_badge            | 1           |
| 17   | gym                  | 206         |
| 18   | git checkout --      | 0           |
|      | ~/Sites/joncursi/re  |             |
|      | dbird-native/ios/re  |             |
|      | dbirdNa              |             |
| 💥   | pilot                | 366         |
| 20   | slack                | 0           |
+------+----------------------+-------------+

[04:21:07]: fastlane finished with errors

Looking for related GitHub issues on fastlane/fastlane...

➡️  HTML: Use `charset` attribute instead of `http-equiv` attribute to specify encoding
    https://github.com/TEAMMATES/teammates/issues/7878 [open] 4 💬
    4 weeks ago

➡️  HTML
    https://github.com/petrosh/snippetrosh/issues/8 [open] 8 💬
    2 weeks ago

➡️  Fixed invalid head content.
    https://github.com/nevir/groc/pull/180 [open] 0 💬
    09 Feb 2015

and 15533 more at: https://github.com/fastlane/fastlane/search?q=%3Chtml%3E%0A%3Chead%3E%0A%3Cmeta%20http-equiv=%22Content-Type%22%20content=%22text/html;charset=ISO-8859-1%22/%3E%0A%3Ctitle%3EError%20403%20%3C/title%3E%0A%3C/head%3E%0A%3Cbody%3E%0A%3Ch2%3EHTTP%20ERROR:%20403%3C/h2%3E%0A%3Cp%3EProblem%20accessing%20/v2/providers/118238965/apps/1269377156/platforms/ios/trains/2.0.8/builds.%20Reason:%0A%3Cpre%3E%20%20%20%20Forbidden%3C/pre%3E%3C/p%3E%0A%3Chr%20/%3E%3Ci%3E%3Csmall%3EPowered%20by%20Jetty://%3C/small%3E%3C/i%3E%0A%3C/body%3E%0A%3C/html%3E%0A&type=Issues&utf8=✓

🔗  You can ⌘ + double-click on links to open them directly in your browser.
/Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/spaceship/lib/spaceship/test_flight/client.rb:216:in `handle_response': [!] <html> (Spaceship::Client::UnexpectedResponse)
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 403 </title>
</head>
<body>
<h2>HTTP ERROR: 403</h2>
<p>Problem accessing /v2/providers/118238965/apps/1269377156/platforms/ios/trains/2.0.8/builds. Reason:
<pre>    Forbidden</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>

	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/spaceship/lib/spaceship/test_flight/client.rb:34:in `block in get_builds_for_train'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/spaceship/lib/spaceship/client.rb:520:in `with_retry'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/spaceship/lib/spaceship/test_flight/client.rb:32:in `get_builds_for_train'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/spaceship/lib/spaceship/test_flight/build.rb:89:in `builds_for_train'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane_core/lib/fastlane_core/build_watcher.rb:33:in `matching_build'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane_core/lib/fastlane_core/build_watcher.rb:11:in `block in wait_for_build_processing_to_be_complete'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane_core/lib/fastlane_core/build_watcher.rb:10:in `loop'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane_core/lib/fastlane_core/build_watcher.rb:10:in `wait_for_build_processing_to_be_complete'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/pilot/lib/pilot/build_manager.rb:38:in `upload'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/actions/pilot.rb:16:in `run'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/runner.rb:252:in `block (2 levels) in execute_action'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/runner.rb:230:in `block in execute_action'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/runner.rb:226:in `chdir'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/runner.rb:226:in `execute_action'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/runner.rb:148:in `trigger_action_by_name'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/fast_file.rb:146:in `method_missing'
	from Fastfile:169:in `block (2 levels) in parsing_binding'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/lane.rb:33:in `call'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/runner.rb:45:in `chdir'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/runner.rb:45:in `execute'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/lane_manager.rb:52:in `cruise_lane'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/command_line_handler.rb:30:in `handle'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/commands_generator.rb:104:in `block (2 levels) in run'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/commander-fastlane-4.4.5/lib/commander/command.rb:178:in `call'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/commander-fastlane-4.4.5/lib/commander/command.rb:153:in `run'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/commander-fastlane-4.4.5/lib/commander/runner.rb:476:in `run_active_command'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:64:in `run!'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/commander-fastlane-4.4.5/lib/commander/delegates.rb:15:in `run!'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/commands_generator.rb:303:in `run'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/commands_generator.rb:42:in `start'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/fastlane/lib/fastlane/cli_tools_distributor.rb:66:in `take_off'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/gems/fastlane-2.57.2/bin/fastlane:20:in `<top (required)>'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/bin/fastlane:23:in `load'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/bin/fastlane:23:in `<main>'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
	from /Users/joncursi/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment

Please run fastlane env and copy the output below. This will help us help you 👍 If you used --capture_output option please remove this block - as it is already included there.

✅ fastlane environment ✅

Stack

Key Value
OS 10.12.6
Ruby 2.4.1
Bundler? true
Git git version 2.13.1
Installation Source ~/.rvm/gems/ruby-2.4.1/bin/fastlane
Host Mac OS X 10.12.6 (16G29)
Ruby Lib Dir ~/.rvm/rubies/ruby-2.4.1/lib
OpenSSL Version OpenSSL 1.1.0f 25 May 2017
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 8.3.3

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
# README: https://github.com/fastlane/fastlane/tree/master/fastlane/docs
# All available actions: https://docs.fastlane.tools/actions
# can also be listed using the `fastlane actions` command

# CONFIG -------------------------------------------------------------------------------------------

# Load custom actions
# See: https://blog.hedgehoglab.com/android-dev-fastlane-review
actions_path './actions'

# Automatically update fastlane if a new version is available
update_fastlane

# Enforce a minimum fastlane version
fastlane_version "2.57.2"

# Enforce a minimum ruby version
ruby_version "2.4.1"

# ENVIRONMENT VARS ---------------------------------------------------------------------------------

# iOS
PATH_TO_IOS = "./ios"
PATH_TO_XCODE_PROJECT = "#{PATH_TO_IOS}/redbirdNative.xcodeproj"

# Android
PATH_TO_ANDROID = "./android"
PATH_TO_GRADLE_BUILD = "#{PATH_TO_ANDROID}/app/build.gradle"

# GENERIC ------------------------------------------------------------------------------------------

def prebuild(lane: lane)
  # Ensure we're on the master branch
  ensure_git_branch
  # Configure Slack
  ENV["SLACK_URL"] = "https://hooks.slack.com/services/#{ENV["SLACK_API_KEY"]}"
  # Ask for bump type
  ENV["BUMP_TYPE"] = prompt(text: "Bump type (major, minor, or patch): ")
  # Auto-generate release notes from git commits
  ENV["DESCRIPTION"] = changelog_from_git_commits(
    match_lightweight_tag: false,
    merge_commit_filtering: "exclude_merges",
    pretty: "* %s - %an (%h)",
    # Use the last known release of this platform > lane as a reference
    tag_match_pattern: "#{lane_context[SharedValues::PLATFORM_NAME]}-#{lane}-*"
  )
  # Ask for release notes
  # ENV["DESCRIPTION"] = prompt(
    # multi_line_end_keyword: "END",
    # text: "Release description: "
  # )
  # Ensure gems are installed
  bundle_install
end

# This block is called only if the executed lane was successful
after_all do |lane|
  # Create a new git tag
  add_git_tag(
    tag: "#{lane_context[SharedValues::PLATFORM_NAME]}-#{lane}-v#{lane_context[SharedValues::VERSION_NUMBER]}"
  )
  # Push the git tag to remote
  push_git_tags
  # Create a new release
  platform_name_display = if lane_context[SharedValues::PLATFORM_NAME] === :android then
    "Android"
  else
    "iOS"
  end
  name = "#{platform_name_display} #{lane} v#{lane_context[SharedValues::VERSION_NUMBER]} (Build ##{lane_context[SharedValues::BUILD_NUMBER]})"
  set_github_release(
    api_token: ENV["GITHUB_TOKEN"],
    description: ENV["DESCRIPTION"],
    is_prerelease: if lane === :beta then
      true
    else
      false
    end,
    name: name,
    repository_name: "joncursi/redbird-native",
    tag_name: last_git_tag,
    upload_assets: if lane_context[SharedValues::PLATFORM_NAME] === :android then
      if lane === :beta then
        ["#{PATH_TO_ANDROID}/app/build/outputs/apk/app-staging.apk"]
      else
        ["#{PATH_TO_ANDROID}/app/build/outputs/apk/app-release.apk"]
      end
    else
      ["./fastlane/build/redbirdNative.ipa"]
    end
  )
  # Send notification to Slack
  if ENV["SLACK_URL"]
    slack(
      message: "Successfully deployed a new #{lane_context[SharedValues::PLATFORM_NAME]} app update.",
      payload: {
        "Build Date" => Time.new.to_s
      }
    )
  end
end

error do |lane, exception|
  # Send the error to Slack
  if ENV["SLACK_URL"]
    slack(
      message: exception.message,
      success: false,
    )
  end
end

# IOS ----------------------------------------------------------------------------------------------

platform :ios do
  before_all do |lane|
    # Run the generic prebuild steps
    prebuild(
      lane: lane
    )
    # Ensure that a standard version of XCode is used
    # verify_xcode
    ensure_xcode_version(version: "8.3.3")
    # Clean the project
    clear_derived_data
    # xcclean
    # Ensure that all pods are up-to-date
    # verify_pod_keys
    # cocoapods(
      # podfile: "#{PATH_TO_IOS}/Podfile"
    # )
    # Increment the version number in XCode
    increment_version_number(
      bump_type: ENV["BUMP_TYPE"],
      xcodeproj: PATH_TO_XCODE_PROJECT
    )
    # Increment the build number in XCode
    increment_build_number({
      build_number: latest_testflight_build_number + 1,
      xcodeproj: PATH_TO_XCODE_PROJECT
    })
    # Commit the version bump
    commit_version_bump(
      message: "(chore) bump iOS app to v#{lane_context[SharedValues::VERSION_NUMBER]}",
      xcodeproj: PATH_TO_XCODE_PROJECT
    )
    # Push the version bump
    push_to_git_remote
    # Ensure all certificates are up-to-date
    match(
      type: "appstore"
    )
  end

  desc "Submit a new beta build to TestFlight"
  lane :beta do
    # Add a "beta" badges
    add_badge(
      dark: true,
      glob: "/ios/**/*.appiconset/*.{png,PNG}"
    )
    # Build the app using the staging release scheme
    gym(
      scheme: "redbirdNative-staging"
    )
    # Reset app icons to default
    sh 'git checkout -- ~/Sites/joncursi/redbird-native/ios/redbirdNative/Images.xcassets/AppIcon.appiconset/'
    # Upload to TestFlight
    pilot
  end

  desc "Deploy a new release to the App Store"
  lane :release do
    # Build the app using the production release scheme
    gym(
      scheme: "redbirdNative-production"
    )
    # Update screenshots
    # snapshot
    # Frame screenshots
    # frameit(
      # path: "./fastlane/screenshots",
      # white: true
    # )
    # Upload to the App Store
    deliver
    # Set the generic iOS changelog text
    set_changelog
  end
end

# ANDROID ------------------------------------------------------------------------------------------

platform :android do
  before_all do |lane|
    # Run the generic prebuild steps
    prebuild(
      lane: lane
    )
    # Clean the Android project
    gradle(
      project_dir: PATH_TO_ANDROID,
      task: "clean"
    )
    # Increment the version number in Gradle
    increment_android_version_number(
      path: PATH_TO_GRADLE_BUILD,
      type: ENV["BUMP_TYPE"]
    )
    # Increment the build number in Gradle
    increment_android_build_number(
      path: PATH_TO_GRADLE_BUILD
    )
    # Commit the version bump
    git_commit(
      path: File.dirname(PATH_TO_GRADLE_BUILD),
      message: "(chore) bump Android app to v#{lane_context[SharedValues::VERSION_NUMBER]}"
    )
    # Create a new changelog
    changelog_file = "metadata/android/en-US/changelogs/#{lane_context[SharedValues::BUILD_NUMBER]}.txt"
    sh(
      "cat ./changelog.txt >> ./#{changelog_file}"
    )
    # Commit the changelog
    changelog_path = File.dirname("./fastlane/#{changelog_file}")
    git_add(
      path: changelog_path
    )
    git_commit(
      path: changelog_path,
      message: "(chore) add changelog for android-#{lane}-v#{lane_context[SharedValues::VERSION_NUMBER]} (build #{lane_context[SharedValues::BUILD_NUMBER]})"
    )
    # Push the version bump and changelog
    push_to_git_remote
  end

  desc "Submit a new beta build to Google Play"
  lane :beta do
    # Add a "beta" badges
    add_badge(
      dark: true,
      glob: "/android/app/src/main/res/**/*.{png,PNG}"
    )
    # Build the release APK
    gradle(
      build_type: "Staging",
      project_dir: PATH_TO_ANDROID,
      task: "assemble"
    )
    # Reset app icons to default
    sh 'git checkout -- ~/Sites/joncursi/redbird-native/android/app/src/main/res'
    # Upload the APK to the Play Store
    supply(
      apk: "#{PATH_TO_ANDROID}/app/build/outputs/apk/app-staging.apk",
      metadata_path: "./fastlane/metadata/android",
      track: "beta"
    )
  end

  desc "Deploy a new release to Google Play"
  lane :release do
    # Build the release APK
    gradle(
      build_type: "Release",
      project_dir: PATH_TO_ANDROID,
      task: "assemble"
    )
    # Upload the APK to the Play Store
    supply(
      apk: "#{PATH_TO_ANDROID}/app/build/outputs/apk/app-release.apk",
      # check_superseded_tracks: true, --> doesn't work?
      metadata_path: "./fastlane/metadata/android",
      track: "beta",
      track_promote_to: "production"
    )
  end
end

`./fastlane/Appfile`
# README: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md

## Android -----------------------------------------------------------------------------------------

# Path to the JSON key file to authenticate our release bot with Google Play
json_key_file "./fastlane/config/supply/google-play-api-secret.json"
# The bundle identifier of the Android app
package_name "com.cheddur"

## iOS ---------------------------------------------------------------------------------------------

# The bundle identifier of the iOS app
app_identifier "com.cheddur"
# The Apple ID used to sign in to iTunes Connect
apple_id "joncursi@gmail.com"
# Team ID for project redbird
team_id "4QTE5EZH9C"

fastlane gems

Gem Version Update-Status
fastlane 2.57.2 ✅ Up-To-Date

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-badge 1.0.0 ✅ Up-To-Date
Loaded gems
Gem Version
did_you_mean 1.1.0
executable-hooks 1.3.2
bundler-unload 1.0.2
rubygems-bundler 1.4.4
bundler 1.16.0.pre.2
io-console 0.4.6
CFPropertyList 2.3.5
i18n 0.8.6
minitest 5.10.3
thread_safe 0.3.6
tzinfo 1.2.3
activesupport 4.2.9
public_suffix 2.0.5
addressable 2.5.2
babosa 1.0.2
curb 0.9.4
fastimage 2.1.0
colored 1.2
highline 1.7.8
commander-fastlane 4.4.5
dotenv 2.2.1
excon 0.59.0
multipart-post 2.0.0
faraday 0.13.1
unf_ext 0.0.7.4
unf 0.1.4
domain_name 0.5.20170404
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
faraday_middleware 0.12.2
gh_inspector 1.0.3
jwt 1.5.6
little-plugger 1.1.4
multi_json 1.12.2
logging 2.2.2
memoist 0.16.0
os 0.9.6
signet 0.7.3
googleauth 0.5.3
httpclient 2.8.3
mime-types-data 3.2016.0521
mime-types 3.1
declarative 0.0.10
declarative-option 0.1.0
uber 0.1.0
representable 3.0.4
retriable 3.1.1
google-api-client 0.13.6
json 2.1.0
mini_magick 4.5.1
multi_xml 0.6.0
plist 3.3.0
rubyzip 1.2.1
security 0.1.3
slack-notifier 1.5.1
terminal-notifier 1.8.0
unicode-display_width 1.3.0
terminal-table 1.8.0
tty-screen 0.5.0
word_wrap 1.0.0
claide 1.0.2
colored2 3.1.2
nanaimo 0.2.3
xcodeproj 1.5.1
rouge 2.0.7
xcpretty 0.2.8
xcpretty-travis-formatter 0.0.4
badge 0.8.5
fuzzy_match 2.0.4
nap 1.1.0
cocoapods-core 1.3.1
cocoapods-deintegrate 1.0.1
cocoapods-downloader 1.1.3
cocoapods-plugins 1.0.0
cocoapods-search 1.0.0
cocoapods-stats 1.0.0
netrc 0.7.8
cocoapods-trunk 1.2.0
cocoapods-try 1.1.0
escape 0.0.4
fourflusher 2.0.1
molinillo 0.5.7
ruby-macho 1.1.0
cocoapods 1.3.1
fastlane-plugin-badge 1.0.0
xcode-install 2.2.1

generated on: 2017-09-20

About this issue

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

Most upvoted comments

I have been having the same issue. One of our projects gets Forbidden after trying for a while.

[09:09:06]: Waiting for iTunes Connect to finish processing the new build (0.15.46 - 204) [09:09:37]: Build doesn’t show up in the build list anymore, waiting for it to appear again … [09:30:32]: Build doesn’t show up in the build list anymore, waiting for it to appear again … /Users/administrator/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.58.0/spaceship/lib/spaceship/test_flight/client.rb:216:in `handle_response’: [!] <html> (Spaceship::Client::UnexpectedResponse)

<head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/> <title>Error 403 </title> </head> <body>

HTTP ERROR: 403

Problem accessing /v2/providers/XXX/apps/XXX/platforms/ios/trains/XXX/builds. Reason:

    Forbidden


<small>Powered by Jetty://</small> </body> </html>

Seeing this today with one of our build deliveries. After some time of waiting for build processing it had this error:

<html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/> <title>Error 403 </title> </head> <body>

HTTP ERROR: 403

Problem accessing /v2/providers/117782761/apps/1030864182/platforms/ios/trains/1.3.4/builds. Reason:

    Forbidden


<small>Powered by Jetty://</small> </body> </html>

I am still seeing this 😢

Could it retry the request a couple times if it returns 403?

Same for me here, but the build still upload to Testflight successfully.

@revolter I agree that retrying on 403 would be a nice feature; is there any other way to hack this behavior in?

@joshdholtz thanks for looking into this.

Sorry for late answers and not so many run samples. Unfortunately I cannot run specific process with the same settings too often for various external reasons and each test takes 2+hrs.

Tests

I though I was having failure every time, but today I had mixed results. All tests done with fastlane-2.89.0

2018-04-16 ~12:30 CEST (end of waiting) - Success ✅

This is first success for me after few tries in last 2 weeks.

  • Waiting time: 1h 30m
    • Time from “Waiting for iTunes Connect to finish processing the new build” to “Successfully finished processing the build”

2018-04-16 ~17:10 CEST (fail time) - Crash 💥

  • Waiting time (until crash): 2h 32m
    • Time from “Waiting for iTunes Connect to finish processing the new build” to “Error finding relevant GitHub issues”
  • This is just little different issue, but still somehow related to 503 or Internal Server Error
  • Logs attached below

2018-04-16 ~19:45 CEST (end of waiting) - Success ✅

This is first success for me after few tries in last 2 weeks.

  • Waiting time: 1h 15m

IPA details

  • Bitcode enabled
    • Main reason for waiting is to get dSYMs from iTC
  • IPA size: ~500MB
    • Size is because it contains Bitcode
    • It used to be always fine with this size before
    • Upload of IPA itself finishes fine, the issue is the waiting for processing (Bitcode compilation and dSYMs to be available)

Summary

Looking at the inconsistent results from today, it really looks like Apple is having some issues with iTC. I just have very bad success/fail ratio 😕

I am not sure if it somehow related to waiting times.

  • Shorter waiting builds (<1.5h) succeeded
  • Longer waiting build (~2.5h) failed
  • It failed for me once already on first polling try after IPA was uploaded.

Suggestion

Would it be possible to have pilot little more fault tolerant? It seems to crash every time it receives unexpected (I guess non-200) response. What about retrying couple more times after an error is received before it finally fails?


Logs of last failure:

INFO [2018-04-16 17:08:21.03]: Build doesn't show up in the build list anymore, waiting for it to appear again (check your email for processing issues if this continues)
14:36:06
Looking for related GitHub issues on fastlane/fastlane...
Search query: 743: unexpected token at '<!DOCTYPE html><html lang="en">
... reduced duplicate HTML output available below
URL: https://api.github.com/search/issues?q=743%3A%20unexpected%20token%20at%20%27%3C%21DOCTYPE%20html%3E%3Chtml%20lang%3D%22en%22%3E%0A%3Chead%3E%0A%3Ctitle%3E%3C%2Ftitle%3E%0A%3Clink%20rel%3D%22stylesheet%22%20href%3D%22%2Fstyles%2Fmain.css%22%3E%0A%3Cstyle%20type%3D%27text%2Fcss%27%3E%0A%20%20%20%20%2F%2Ainclude%20..%2F..%2Fdist%2Fstyles%2Fmain.css%2A%2F%0A%3C%2Fstyle%3E%0A%3C%2Fhead%3E%0A%0A%3Cbody%3E%3Cdiv%20id%3D%22wrapper%22%20class%3D%22j42%22%3E%0A%3Ch2%3EInternal%20Server%20Error%3C%2Fh2%3E%3C%2Fdiv%3E%0A%0A%3Cdiv%20class%3D%22footer%22%3E%0A%20%20%20%20%3Cp%3ECopyright%20%26copy%3B%20%3Cspan%20id%3D%27year%27%3E2015%3C%2Fspan%3E%20Apple%20Inc.%20All%20rights%20reserved.%3C%2Fp%3E%0A%20%20%20%20%3Cul%3E%3Cli%3E%3Ca%20href%3D%22http%3A%2F%2Fwww.apple.com%2Flegal%2Finternet-services%2Fitunes%2Fus%2Fterms.html%22%3ETerms%20of%20Service%3C%2Fa%3E%3C%2Fli%3E%3Cli%3E%3Ca%20href%3D%22http%3A%2F%2Fwww.apple.com%2Flegal%2Fprivacy%22%3EPrivacy%20Policy%3C%2Fa%3E%3C%2Fli%3E%3Cli%3E%3Ca%20href%3D%22http%3A%2F%2Fwww.apple.com%2Fsupport%2F%22%3EContact%20Us%3C%2Fa%3E%3C%2Fli%3E%3C%2Ful%3E%0A%3C%2Fdiv%3E%0A%0A%0A%3Cscript%20type%3D%27text%2Fjavascript%27%3E%28function%28%29%20%7B%0A%20%20%20%20var%20isIos%20%3D%20navigator.userAgent.match%28%2F%28iPod%7CiPhone%7CiPad%29%2F%29%3B%0A%20%20%20%20document.body.setAttribute%28%20%27class%27%2C%20%28%21isIos%29%20%3F%20%27otherBrowser%27%20%3A%20%27isMobileSafari%27%20%29%0A%20%20%20%20var%20yearEl%20%3D%20document.getElementById%28%27year%27%29%3B%0A%20%20%20%20if%20%28yearEl%29%20%7B%20yearEl.textContent%20%3D%20new%20Date%28%29.getFullYear%28%29%3B%20%7D%0A%7D%29%28%29%3B%0A%3C%2Fscript%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%27+repo:fastlane/fastlane
ERROR [2018-04-16 17:11:24.15]: Error finding relevant GitHub issues: undefined method `map' for nil:NilClass
/usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/json/common.rb:156:in `parse': [!] 743: unexpected token at '<!DOCTYPE html><html lang="en"> (Faraday::ParsingError)
<head>
<title></title>
<link rel="stylesheet" href="/styles/main.css">
<style type='text/css'>
    /*include ../../dist/styles/main.css*/
</style>
</head>

<body><div id="wrapper" class="j42">
<h2>Internal Server Error</h2></div>

<div class="footer">
    <p>Copyright &copy; <span id='year'>2015</span> Apple Inc. All rights reserved.</p>
    <ul><li><a href="http://www.apple.com/legal/internet-services/itunes/us/terms.html">Terms of Service</a></li><li><a href="http://www.apple.com/legal/privacy">Privacy Policy</a></li><li><a href="http://www.apple.com/support/">Contact Us</a></li></ul>
</div>


<script type='text/javascript'>(function() {
    var isIos = navigator.userAgent.match(/(iPod|iPhone|iPad)/);
    document.body.setAttribute( 'class', (!isIos) ? 'otherBrowser' : 'isMobileSafari' )
    var yearEl = document.getElementById('year');
    if (yearEl) { yearEl.textContent = new Date().getFullYear(); }
})();
</script>

</body>
</html>'
	from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/json/common.rb:156:in `parse'
	from /usr/local/lib/ruby/gems/2.4.0/gems/faraday_middleware-0.12.2/lib/faraday_middleware/response/parse_json.rb:11:in `block in <class:ParseJson>'
	from /usr/local/lib/ruby/gems/2.4.0/gems/faraday_middleware-0.12.2/lib/faraday_middleware/response_middleware.rb:51:in `parse'
	from /usr/local/lib/ruby/gems/2.4.0/gems/faraday_middleware-0.12.2/lib/faraday_middleware/response_middleware.rb:40:in `process_response'
	from /usr/local/lib/ruby/gems/2.4.0/gems/faraday_middleware-0.12.2/lib/faraday_middleware/response_middleware.rb:33:in `block in call'
... and so on

Recently we also started to see this issue. Can’t reproduce it reliably, sometimes it works, other times it doesn’t. Environment is the same, credentials are the same, but sometimes it will crash while waiting for build to become available in iTunes Connect.

+------+----------------------------+-------------+
|                fastlane summary                 |
+------+----------------------------+-------------+
| Step | Action                     | Time (in s) |
+------+----------------------------+-------------+
| 1    | default_platform           | 0           |
| 2    | setup_circle_ci            | 0           |
| 3    | ensure_git_status_clean    | 0           |
| 4    | ensure_git_branch          | 0           |
| 5    | changelog_from_git_commits | 0           |
| 6    | get_version_number         | 0           |
| 7    | increment_build_number     | 2           |
| 8    | commit_version_bump        | 0           |
| 9    | push_to_git_remote         | 2           |
| 10   | add_badge                  | 9           |
| 11   | sync_code_signing          | 1           |
| 12   | build_ios_app              | 242         |
| 💥   | upload_to_testflight       | 809         |
+------+----------------------------+-------------+

[08:17:31]: fastlane finished with errors

Looking for related GitHub issues on fastlane/fastlane...

bundler: failed to load command: fastlane (/Users/distiller/.gem/ruby/2.5.1/bin/fastlane)
Spaceship::UnexpectedResponse: [!] <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 403 </title>
</head>
<body>
<h2>HTTP ERROR: 403</h2>
<p>Problem accessing /v2/providers/117129531/apps/950000769/platforms/ios/trains/3.0.0/builds. Reason:
<pre>    Forbidden</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>

  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/spaceship/lib/spaceship/test_flight/client.rb:296:in `handle_response'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/spaceship/lib/spaceship/test_flight/client.rb:38:in `block in get_builds_for_train'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/spaceship/lib/spaceship/client.rb:522:in `with_retry'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/spaceship/lib/spaceship/test_flight/client.rb:36:in `get_builds_for_train'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/spaceship/lib/spaceship/test_flight/build.rb:113:in `builds_for_train'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane_core/lib/fastlane_core/build_watcher.rb:45:in `matching_build'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane_core/lib/fastlane_core/build_watcher.rb:23:in `block in wait_for_build_processing_to_be_complete'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane_core/lib/fastlane_core/build_watcher.rb:22:in `loop'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane_core/lib/fastlane_core/build_watcher.rb:22:in `wait_for_build_processing_to_be_complete'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/pilot/lib/pilot/build_manager.rb:54:in `upload'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/actions/upload_to_testflight.rb:16:in `run'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:257:in `block (2 levels) in execute_action'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:236:in `block in execute_action'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:231:in `chdir'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:231:in `execute_action'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/fast_file.rb:148:in `method_missing'
  Fastfile:137:in `block (2 levels) in parsing_binding'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/lane.rb:33:in `call'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/lane_manager.rb:57:in `cruise_lane'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run'
  /Users/distiller/.gem/ruby/2.5.1/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call'
  /Users/distiller/.gem/ruby/2.5.1/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run'
  /Users/distiller/.gem/ruby/2.5.1/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:75:in `run!'
  /Users/distiller/.gem/ruby/2.5.1/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/commands_generator.rb:333:in `run'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/commands_generator.rb:42:in `start'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/fastlane/lib/fastlane/cli_tools_distributor.rb:107:in `take_off'
  /Users/distiller/.gem/ruby/2.5.1/gems/fastlane-2.89.0/bin/fastlane:20:in `<top (required)>'
  /Users/distiller/.gem/ruby/2.5.1/bin/fastlane:23:in `load'
  /Users/distiller/.gem/ruby/2.5.1/bin/fastlane:23:in `<top (required)>'
Exited with code 1

@johannth @Albob Even with the role set to “App Manager” this can happen. Yesterday some of my builds were failing because of that again, and they worked some hours later.

I could reproduce this on iTC trying to edit the build changelog (see my comment here).