Search code examples
iosshellcurlfastlanefirebase-crash-reporting

fastlane run custom shell script failed


I have firebase crash report integrated in my app. According to Firebase docs I should add custom shell script under Xcode build phase as follows:

JSONF="${PODS_ROOT}/../AppName/Resources/Other/name-firebase-crashreporting-xfgzl-92c3174357.json"

GOOGLE_APP_ID=1:xxxxxxxxxxxx:ios:xxxxxxxxxxxxxxxx

defaults write com.google.SymbolUpload version -integer 1
JSON=$(cat "${JSONF}")
/usr/bin/plutil -replace "app_${GOOGLE_APP_ID//:/_}" -json "${JSON}" "$HOME/Library/Preferences/com.google.SymbolUpload.plist"
"${PODS_ROOT}"/FirebaseCrash/upload-sym -vv "${JSONF}"

if I did the archiving using Xcode archive (UI) I will get the following logs: enter image description here

as you can see if token is invalid a new request will be made to get a new one, so far so good, in contrary in the if I ask fastlane to build the project I am getting the following:

/Users/xxx/Desktop/s3/njm/name-ios/Pods/FirebaseCrash/upload-sym-util.bash:148: note: access_token not found in 
/Users/xxx/Library/Preferences/com.google.SymbolUploadToken.plist. Token invalid.
/Users/xxx/Desktop/s3/njm/name-ios/Pods/FirebaseCrash/upload-sym-util.bash:229: note: Token cannot be used.  Requesting OAuth2 token using installed credentials.
/Users/xxx/Desktop/s3/njm/name-ios/Pods/FirebaseCrash/upload-sym-util.bash:235: note: Certificate information appears valid.
*   Trying 216.58.204.109...
* Connected to accounts.google.com (216.58.204.109) port 443 (#0)
* SSL: certificate verification failed (result: 5)
* Closing connection 0
Command /bin/sh failed with exit code 1

so the problem is in curl certificate verification failed am I missing something ?


Solution

  • By following the below steps, I could get it done and everything is working fine:

    1 - I installed curl from Homebrew : brew install curl --with-openssl

    2 - Point the curl PATH to the freshly installed one: brew link --force curl

    3 - Run this: curl --remote-name --time-cond cacert.pem https://curl.haxx.se/ca/cacert.pem