fastlane-plugin-appcenter: Cannot upload ios via appcenter_upload using 1.9.0

I am using the following command:

    appcenter_upload(
        api_token: ENV["APPCENTER_API_TOKEN"],
        owner_name: ENV["APPCENTER_OWNER_NAME"],
        app_name: ENV["APPCENTER_APP_NAME"],
        file: "PATH-To-IPA",
        release_notes: "RELEASE-NOTES"
        )

and it is giving the following error:

Client error: 400: {"error"=>{"code"=>400, "message"=>"The request contains invalid content."}}

It is working fine with the 1.8.1 version though.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 54
  • Comments: 32 (2 by maintainers)

Most upvoted comments

I believe this issue was introduced by a change in fastlane 2.161.0. Previously fastlane was preventing the default Content-Type header in some cases, even those in plugins. The change made it specific to apple.com since that was the original intent, however this plugin appears to have been unintentionally depending on that behavior. I’m able to fix the upload locally by adding the Content-Type header to the chunk upload request. I’ll open a PR once I do a bit more checking. In the mean time, the change below fixes the failure for me:

Screen Shot 2020-10-01 at 4 18 01 PM

I just released v1.10.0. Can someone please confirm if it fixes their issue?

Thanks @rimarsh and @joshdholtz for the help with the fix 🥳

For those using Fastlane via a Bundler, that is, with a Gemfile, you can lock it to version 2.160.0 like this:

# Gemfile

# There is an issue with Fastlane 2.161.0 and the App Center plugin.
# See https://github.com/microsoft/fastlane-plugin-appcenter/issues/247
gem "fastlane", "2.160.0"

Fastlane version 2.161.0 with appcenter_plugin 1.9.0 throws Client error: 400: {“error”=>{“code”=>400, “message”=>“The request contains invalid content.”}}

Reverting to fastlane version 2.160.0 works. Try using the below commands to reinstall fastlane of specific version

gem uninstall fastlane
gem install fastlane --version 2.160.0

Fastlane version 2.160.0 with appcenter_plugin 1.9.0 works fine

It’s clearly a backend issue with the new upload endpoint. Hopefully, someone from Microsoft gets to fixing this issue soon. Until then, we need to use those older versions.

https://github.com/microsoft/fastlane-plugin-appcenter/commit/e35509d0c326578655cf0870806e770cede30fb7#diff-af4cae5a145a0689c65242cefbb3da5bR65

v1.10.0 works fine!!! Thanks!!

@lumaxis It fixed the issue I was running into with uploads on 1.9.0. Thanks!

I commented this in the PR but this was a side effect of a monkey patch that we had in fastlane that would default content type of all requests to application/json if not set. We removed this because we shouldn’t have been relying on this in this PR - https://github.com/fastlane/fastlane/pull/17218

Sorry for any issues this may have caused! PR #248 is the correct solution 👍

How do I revert back?

this is added to my PluginFile but 1.9.0 is the used version

gem 'fastlane-plugin-appcenter', "1.8.1"

Can confirm from our side: fastlane 2.160.0 works with the latest appcenter plugin, but 2.162.0 throws the error above. Rolling back to appcenter 1.8.1 also solves the problem and works with 2.162.0.

+1

downgrading fastlane version from 2.161.0 to 2.158.0 solved the upload problem