fastlane: Fastlane Precheck fails with 'Failed: No broken urls-> unreachable URLs in app metadata'

New Issue Checklist

Issue Description

I’m running precheck as always, and since two days ago started to fail with unreachable url, for support, marketing and privacy URL’s. The urls are ok, they don’t redirect and they are giving a 200 OK status.

Captured Output

Command Used: check_metadata

Output/Log

Successfully loaded Appfile at path '/Users/juannuvreni/Desktop/Development/Mascoteros/mascoteros-ios/Mascoteros/fastlane/Appfile'
- apple_id: 'apple@mascoteros.com'
- team_id: '2279G3HUYX'
-------

+--------------------------+----------------------+
|           Summary for precheck 2.66.2           |
+--------------------------+----------------------+
| username                 | apple@mascoteros.com |
| default_rule_level       | error                |
| include_in_app_purchases | true                 |
+--------------------------+----------------------+

Looking for iTunes Connect Team with ID 118116013

+------+-------------------------------------+-------------+
|                     fastlane summary                     |
+------+-------------------------------------+-------------+
| Step | Action                              | Time (in s) |
+------+-------------------------------------+-------------+
| 1    | Verifying required fastlane version | 0           |
| 2    | default_platform                    | 0           |
| 3    | cocoapods                           | 20          |
| 💥   | precheck                            | 5           |
+------+-------------------------------------+-------------+



✅ fastlane environment ✅

Stack

Key Value
OS 10.13.1
Ruby 2.4.0
Bundler? false
Git git version 2.13.6 (Apple Git-96)
Installation Source ~/.rvm/gems/ruby-2.4.0/bin/fastlane
Host Mac OS X 10.13.1 (17B48)
Ruby Lib Dir ~/.rvm/rubies/ruby-2.4.0/lib
OpenSSL Version OpenSSL 1.1.0e 16 Feb 2017
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 9.1

System Locale

Variable Value
LANG en_GB.UTF-8
LC_ALL
LANGUAGE

fastlane files:

`./Fastfile`
# Customise this file, documentation can be found here:
# 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

# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`

# If you want to automatically update fastlane if a new version is available:
# update_fastlane

# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "2.54.1"

default_platform :ios

platform :ios do
  before_all do
    
    # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..." TO-DO: Set the hook with Slack
   
    cocoapods
    
  end

  desc "Runs all the tests"
  lane :test do
          scan(scheme: "Pods-MascoterosTests",
               clean: true,
               device: "iPhone 6s (10.3)",
       )
  end

  # You can define as many lanes as you want
############################################################################################################################################################################
  desc "MASCOTEROS - BETA : Run the tests and then upload a new Beta Build to Apple TestFlight"
  desc "This will also make sure the profile is up to date"
  lane :beta_release do
    
    ENV["APP_IDENTIFIER"] = "com.mascoteros.MascoterosIOS.TestFlight"
    
    match(type: "appstore")
    increment_build_number
    #commit_version_bump
    gym(scheme: "Mascoteros-Staging")
    pilot
  end
############################################################################################################################################################################
  desc "MASCOTEROS - RELEASE : Run the tests and then upload a new release Build to Apple Appstore"
  desc "Deploy a new version to the App Store"
  lane :release do

    ENV["APP_IDENTIFIER"] = "com.mascoteros.MascoterosIOS"

    match(type: "appstore")
    #snapshot
    #frameit
    increment_build_number
    #increment_version_number(bump_type: "minor")
    gym(scheme: "Mascoteros-AppStore") # Build your app - more options available
    deliver(precheck_default_rule_level: :error)
    #deliver(force: true)
    
  end

############################################################################################################################################################################
  desc "MASCOTEROS - PRECHECK : Pre check before uploading to appstore"
  lane :check_metadata do
    precheck
  end

  after_all do |lane|
    # This block is called, only if the executed lane was successful

    # slack(
    #   message: "Successfully deployed new App Update."
    # )
  end

  error do |lane, exception|
    # slack(
    #   message: exception.message,
    #   success: false
    # )
  end
end


# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
# All available actions: https://docs.fastlane.tools/actions

# fastlane reports which actions are used
# No personal data is recorded. Learn more at https://github.com/fastlane/enhancer

`./Appfile`
app_identifier ENV["APP_IDENTIFIER"] #"com.mascoteros.MascoterosIOS" # The bundle identifier of your app
apple_id "apple@mascoteros.com" # Your Apple email address

team_id "2279G3HUYX" # Developer Portal Team ID

# you can even provide different app identifiers, Apple IDs and team names per lane:
# More information: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md

fastlane gems

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

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.1.0
slack-notifier 1.5.1
CFPropertyList 2.3.5
claide 1.0.2
colored2 3.1.2
nanaimo 0.2.3
xcodeproj 1.5.3
rouge 1.11.1
xcpretty 0.2.6
terminal-notifier 1.7.1
unicode-display_width 1.1.3
terminal-table 1.7.3
plist 3.2.0
public_suffix 2.0.5
addressable 2.5.1
multipart-post 2.0.0
word_wrap 1.0.0
tty-screen 0.6.2
babosa 1.0.2
colored 1.2
highline 1.7.8
commander-fastlane 4.4.5
excon 0.55.0
faraday 0.12.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
fastimage 2.1.0
gh_inspector 1.0.3
json 2.0.2
mini_magick 4.5.1
multi_json 1.12.1
multi_xml 0.6.0
rubyzip 1.2.1
security 0.1.3
xcpretty-travis-formatter 0.0.4
dotenv 2.2.0
bundler 1.14.6
faraday_middleware 0.11.0.1
uber 0.0.15
declarative 0.0.9
declarative-option 0.1.0
representable 3.0.4
retriable 2.1.0
mime-types-data 3.2016.0521
mime-types 3.1
little-plugger 1.1.4
logging 2.2.2
jwt 1.5.6
memoist 0.15.0
os 0.9.6
signet 0.7.3
googleauth 0.5.1
httpclient 2.8.3
google-api-client 0.13.4
io-console 0.4.6
openssl 2.0.2
bigdecimal 1.3.0
psych 2.2.2

generated on: 2017-11-27

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 37 (17 by maintainers)

Most upvoted comments

However, I don’t understand 2 things:

  1. Q: Why did I have the issue with my isolated file where I had to replace URI by Addressable::URI? In my local Fastlane copy I didn’t have to change this. Or does Fastlane links somewhere else to the URI lib? A: When I add require "uri" to my test file it works. When I search the Fastlane repo, many classes use this. new Q: Is Addressable ::URI the same as URI? If so, probably the solution is to remove Addressable from: https://github.com/fastlane/fastlane/blob/f2ea29347f894c00dc55e87a0e45c6063319d791/precheck/lib/precheck/rules/unreachable_urls_rule.rb#L27 Instead of adding require 'addressable'. I verified this in my local repo and it works too: INFO [2017-12-10 01:58:23.23]: ✅ Passed: No broken urls

  2. Q: Why does precheck work for @milch (see his https://github.com/fastlane/fastlane/issues/11027#issuecomment-347486879) while it doesn’t for many users like me. Only after adding the link to ‘addressable’ it works. I searched the Fastlane repo for require 'addressable' but it isn’t in. Are there multiple configurations around?

In summary, there are 2 solutions:

  1. Add require 'addressable' or
  2. Replace Addressable::URI by URI

I was able to get the script running by:

  1. replacing URI in the request line by Addressable::URI. Now an error on the next line was given about uninitialized constant FaradayMiddleware
  2. adding require "faraday_middleware". This was a mistake of my isolated test file.

So only change 1 seems the solution.

I added the print line to show the result.

The final code:

require "addressable"
require "faraday"
require "faraday_middleware"

url = 'http://www.google.com'

url = url.to_s.strip
uri = Addressable::URI.parse(url)
uri.fragment = nil

request = Faraday.new(Addressable::URI.encode(uri.to_s)) do |connection|
    connection.use FaradayMiddleware::FollowRedirects
    connection.adapter :net_http
end

print "Status for '#{Addressable::URI.encode(uri.to_s)}' = #{request.head.status}\n"

The result:

Martijns-MacBook-Pro:Desktop Martijn$ ruby testURLCheck.rb 
Status for 'http://www.google.com' = 200

And ran again for the particular URL of this issue:

Martijns-MacBook-Pro:Desktop Martijn$ ruby testURLCheck.rb 
Status for 'https://www.mascoteros.com' = 200

I have the same issue where my valid URLs are reported erroneous. The error “URL https://www.mascoteros.com not reachable 😵” is given in https://github.com/fastlane/fastlane/blob/f2ea29347f894c00dc55e87a0e45c6063319d791/precheck/lib/precheck/rules/unreachable_urls_rule.rb#L35 as part of the rescue action. Doesn’t this mean that the begin code is failing?

When I isolate the begin code in a small test Ruby file and run it in Terminal, it fails on the request line with:

Martijns-MacBook-Pro:Desktop Martijn$ ruby testURLCheck.rb 
testURLCheck.rb:10:in `<main>': uninitialized constant URI (NameError)

Here is the file content of testURLCheck.rb:

require "addressable"
require "faraday"

url = 'http://www.google.com'
url = url.to_s.strip
uri = Addressable::URI.parse(url)
uri.fragment = nil

request = Faraday.new(URI.encode(uri.to_s)) do |connection|
    connection.use FaradayMiddleware::FollowRedirects
    connection.adapter :net_http
end

@sheinix Also, please run the following command from the command line in your project directory:

echo -e "\`\`\`\n" $(cat fastlane/metadata/en-US/marketing_url.txt) "\n\`\`\`" | pbcopy

Make sure the path after cat points to one of the files with a URL that is failing. It should copy the output to the clipboard. Please paste the result here, exactly as it was copied