Firebase 抛出“服务器响应状态 400”

Ale*_*lex 2 build-automation firebase fastlane

我正在为一个应用程序实现 CICD,该应用程序是在 React Native 中完成的,但现在我遇到的情况是 Firebase 不允许我上传 ipa 和 apk“服务器以状态 400 响应”。我首先使用我的帐户进行上传,现在它运行良好,现在我正在使用另一个帐户。现在不让我上传了。

\n

这就是我在终端窗口中得到的内容。

\n
[13:28:30]:  Authenticated successfully.\n[13:28:33]: \xe2\x8c\x9b Uploading the APK.\n[13:28:47]: \xe2\x9c\x85 Uploaded the APK.\n[13:28:48]: the server responded with status 400\n+------+---------------------------+-------------+\n|                fastlane summary                |\n+------+---------------------------+-------------+\n| Step | Action                    | Time (in s) |\n+------+---------------------------+-------------+\n| 1    | clean assembleRelease     | 315         |\n|    | firebase_app_distribution | 18          |\n+------+---------------------------+-------------+\n
Run Code Online (Sandbox Code Playgroud)\n

Eri*_*ton 5

400意思是“错误的请求”。而且,说实话,这缺乏 Fastlane 的详细信息,因为它只是表明(回顾性地)提供的配置不完整或不正确。

以下是此处发生的情况的示例:原因是从 Firebase 项目复制了错误的应用程序 ID(我正在尝试编码的应用程序 ID,而不是应用程序 ID)。

platform :ios do
  desc 'Me App'
  lane :beta do
      build_ios_app(
        export_method: 'ad-hoc',
        export_options: {
        provisioningProfiles: {
            'com.example.meapp' => 'Me App'
          }
        }
      )
      firebase_app_distribution(
          app: 'bad_id',   # The 400 was from a bad ID here.
          testers: 'eric.platon@gmail.com',
          release_notes: release_notes,
      )
  end
end
Run Code Online (Sandbox Code Playgroud)

截至撰写本文时,我在 Fastlane 的错误跟踪中找到了线索。某些Ruby 代码引发了错误。

def self.run(params)
  params.values      # <= printing out the `params` showed all pieces that could lead to a 400 Bad Request
  # ...
  app = fad_api_client.get_app(app_id, app_view)
Run Code Online (Sandbox Code Playgroud)

看看它是如何损坏的,有助于理解罪魁祸首是这里的应用程序 ID。希望这在 OP 情况下也足够了。