Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase app distribution via Fastlane "the server responded with status 403"

I setup Firebase app distribution feature in Fastlane Fastfile to distribute beta version of my iOS app. It was working fine but It suddenly started showing errors.

This is how my lane looks like.

lane :distribute_beta do |options|
        
        sync_code_signing_adhoc()
        update_build_number_of_all_frameworks() 
        build_ios_app_adhoc()

        firebase_app_distribution(
            app: "<app ID here>",
            testers: "<tester emials here>",
            release_notes: options[:release_note],
            firebase_cli_path: "/usr/local/bin/firebase"
        )
end  

When I run this lane it shows error

the server responded with status 403

on Step: firebase_app_distribution

Log also says authentication to google succeeded.

 Authenticating with GOOGLE_APPLICATION_CREDENTIALS environment variable: /<path to cred>/<cred_file_name>.json
 🔐 Authenticated successfully.

Following is entire error around "Step: firebase_app_distribution "

[17:11:04]: ---------------------------------------
[17:11:04]: --- Step: firebase_app_distribution ---
[17:11:04]: ---------------------------------------
[17:11:04]: Authenticating with GOOGLE_APPLICATION_CREDENTIALS environment variable: /<path to cred>/<cred_file_name>.json
[17:11:04]: 🔐 Authenticated successfully.
+------------------------------------+---------------------------------------------+
|                                   Lane Context                                   |
+------------------------------------+---------------------------------------------+
| DEFAULT_PLATFORM                   | ios                                         |
| PLATFORM_NAME                      | ios                                         |
| LANE_NAME                          | ios distribute_beta                         |
| SIGH_PROFILE_TYPE                  | ad-hoc                                      |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"<my bndle ID>"=>"match AdHoc              |
|                                    | <my bundle ID>"}                            |
| BUILD_NUMBER                       | 107                                         |
| IPA_OUTPUT_PATH                    | /Users/my_user_name/Repository/App/App|
|                                    | y/App.ipa                                   |
| XCODEBUILD_ARCHIVE                 | /Users/my_user_name/Library/Developer/Xcode/A|
|                                    | rchives/2021-01-08/App 2021-01-08           |
|                                    | 17.09.08.xcarchive                          |
| DSYM_OUTPUT_PATH                   | /Users/my_user_name/Repository/App/App           |
|                                    | y/App.app.dSYM.zip                          |
+------------------------------------+---------------------------------------------+
[17:11:06]: the server responded with status 403

+------+-----------------------------+-------------+
|                 fastlane summary                 |
+------+-----------------------------+-------------+
| Step | Action                      | Time (in s) |
+------+-----------------------------+-------------+
| 1    | default_platform            | 0           |
| 2    | Switch to ios               | 0           |
|      | sync_code_signing_adhoc     |             |
|      | lane                        |             |
| 3    | sync_code_signing           | 18          |
| 4    | Switch to ios               | 0           |
|      | update_build_number_of_all  |             |
|      | _frameworks lane            |             |
| 5    | increment_build_number      | 1           |
| 6    | commit_version_bump         | 0           |
| 7    | Switch to ios               | 0           |
|      | build_ios_app_adhoc lane    |             |
| 8    | build_ios_app               | 126         |
| 💥   | firebase_app_distribution   | 1           |
+------+-----------------------------+-------------+

[17:11:06]: fastlane finished with errors

How can I fix this?

like image 243
Bigair Avatar asked Mar 01 '23 19:03

Bigair


2 Answers

Usually, when you get that specific message it means that the Firebase Refresh Token is no longer valid.

So, when you submit the app, at some point, you have to specify the Firebase Refresh Token:

...
firebase_app_distrubution(
  ...
  firebase_cli_token: "<YourFirebaseRefreshToken>"
)
...

You can get this token from here. If your script started to fail out of nowhere, that probably means that whoever generated this (or any other authentication token) got removed from the Firebase project.

If you're getting a 403 that definitely means that either someone got removed from your Firebase project or that someone removed/regenerated a token on the Firebase console.

like image 124
4gus71n Avatar answered Apr 29 '23 12:04

4gus71n


  1. Simply run the following command on console:

    curl -sL https://firebase.tools | bash
    
  2. then, authenticate on the browser

  3. Then run

    firebase login:ci
    
  4. After success you will get printed your new cli token, like this:

Waiting for authentication...

✔  Success! Use this token to login on a CI server:

1//here_will_be_your_new_token

Example: firebase deploy --token "$FIREBASE_TOKEN"
like image 34
Bartłomiej Semańczyk Avatar answered Apr 29 '23 10:04

Bartłomiej Semańczyk