fastlane: MultiJson Parser Error

Its occuring when I am executing fastlane android screenshots

55: from C:/Ruby27-x64/bin/fastlane:23:in `<main>'
        54: from C:/Ruby27-x64/bin/fastlane:23:in `load'
        53: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/bin/fastlane:23:in `<top (required)>'
        52: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in `take_off'
        51: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/commands_generator.rb:41:in `start'
        50: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/commands_generator.rb:349:in `run'
        49: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
        48: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in `run!'
        47: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command'
        46: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run'
        45: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call'
        44: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run'
        43: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
        42: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/lane_manager.rb:56:in `cruise_lane'
        41: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
        40: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
        39: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
        38: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/lane.rb:33:in `call'
        37: from Fastfile:56:in `block (2 levels) in parsing_binding'
        36: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
        35: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
        34: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/runner.rb:227:in `execute_action'
        33: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/runner.rb:227:in `chdir'
        32: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/runner.rb:253:in `block in execute_action'
        31: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
        30: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/runner.rb:261:in `block (2 levels) in execute_action'
        29: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/fastlane/lib/fastlane/actions/upload_to_play_store.rb:33:in `run'
        28: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/supply/lib/supply/uploader.rb:32:in `perform_upload'
        27: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/supply/lib/supply/uploader.rb:81:in `perform_upload_meta'
        26: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/supply/lib/supply/uploader.rb:81:in `each'
        25: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/supply/lib/supply/uploader.rb:89:in `block in perform_upload_meta'
        24: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/supply/lib/supply/uploader.rb:89:in `each'
        23: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/supply/lib/supply/uploader.rb:97:in `block (2 levels) in perform_upload_meta'
        22: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/supply/lib/supply/uploader.rb:273:in `upload_screenshots'
        21: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/supply/lib/supply/uploader.rb:273:in `each'
        20: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/supply/lib/supply/uploader.rb:278:in `block in upload_screenshots'
        19: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/supply/lib/supply/client.rb:500:in `clear_screenshots'
        18: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/supply/lib/supply/client.rb:80:in `call_google_api'
        17: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/fastlane-2.143.0/supply/lib/supply/client.rb:501:in `block in clear_screenshots'
        16: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/google-api-client-0.36.4/generated/google/apis/androidpublisher_v3/service.rb:909:in `deleteall_edit_image'
        15: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/google-api-client-0.36.4/lib/google/apis/core/base_service.rb:360:in `execute_or_queue_command'
        14: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/google-api-client-0.36.4/lib/google/apis/core/http_command.rb:102:in `execute'
        13: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/retriable-3.1.2/lib/retriable.rb:56:in `retriable'
        12: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/retriable-3.1.2/lib/retriable.rb:56:in `times'
        11: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/retriable-3.1.2/lib/retriable.rb:61:in `block in retriable'
        10: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/google-api-client-0.36.4/lib/google/apis/core/http_command.rb:110:in `block in execute'
         9: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/retriable-3.1.2/lib/retriable.rb:56:in `retriable'
         8: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/retriable-3.1.2/lib/retriable.rb:56:in `times'
         7: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/retriable-3.1.2/lib/retriable.rb:61:in `block in retriable'
         6: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/google-api-client-0.36.4/lib/google/apis/core/http_command.rb:113:in `block (2 levels) in execute'
         5: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/google-api-client-0.36.4/lib/google/apis/core/http_command.rb:310:in `execute_once'
         4: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/google-api-client-0.36.4/lib/google/apis/core/http_command.rb:194:in `process_response'
         3: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/google-api-client-0.36.4/lib/google/apis/core/api_command.rb:86:in `decode_response_body'
         2: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/representable-3.0.4/lib/representable/json.rb:38:in `from_json'
         1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/multi_json-1.14.1/lib/multi_json.rb:122:in `load'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/multi_json-1.14.1/lib/multi_json/adapter.rb:20:in `load': \e[31m[!] JSON::ParserError\e[0m (MultiJson::ParseError)

Here is the detail of fastlane env

✅ fastlane environment ✅

Stack

Key Value
OS UNKNOWN
Ruby 2.7.0
Bundler? false
Git git version 2.25.1.windows.1
Installation Source C:/Ruby27-x64/bin/fastlane
Host Unknown ()
Ruby Lib Dir C:/Ruby27-x64/lib
OpenSSL Version OpenSSL 1.1.1d 10 Sep 2019
Is contained false
Is homebrew false
Is installed via Fabric.app false

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL en_US.UTF-8
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:android)

platform :android do
  desc "Runs all the tests"
  lane :test do
    gradle(task: "test")
  end

# capturing screenshot
desc "Capture Screen"
lane :screenshot do
    gradle(task: "clean assembleDebug assembleAndroidTest")
    screengrab
end

lane :screenshots do
  screenshot
  upload_to_play_store(
             json_key: 'serviceApiKeyfinal.json',
             skip_upload_apk: true,
             skip_upload_metadata: true,
             skip_upload_aab: true,
             skip_upload_images: false,
             skip_upload_screenshots: false,
             track: 'beta'
             )
end

  desc "Submit a new Beta Build to Crashlytics Beta"
  lane :beta do
     gradle(task: 'clean')
     gradle(
          task: "assemble",
          build_type: "Release",
           properties: {
                  "android.injected.signing.store.file" => "dsss.jks",
                  "android.injected.signing.store.password" => "pass",
                  "android.injected.signing.key.alias" => "alias",
                  "android.injected.signing.key.password" => "pass",
                  })
          upload_to_play_store(
           track: 'beta',
           json_key: 'serviceApiKeyfinal.json',
           skip_upload_apk: true,
           skip_upload_metadata: true,
           skip_upload_images: true,
           skip_upload_screenshots: true)

    # sh "your_script.sh"
    # You can also use other beta testing services here
  end

  desc "Deploy a new version to the Google Play"
  lane :playstore do
    gradle(
        task: 'assemble',
        build_type: 'Release'
      )

     upload_to_play_store(
           track_promote_to: 'production',
           json_key: 'serviceApiKeyfinal.json',
           skip_upload_apk: true,
           skip_upload_metadata: true,
           skip_upload_images: true,
           skip_upload_screenshots: true,
           track: 'beta'
           )
     # Uploads the APK built in the gradle step above and releases it to all production users
  end
end

`./fastlane/Appfile`
json_key_file("serviceApiKeyfinal.json") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one
package_name("har.fastlanescreenshotandplaystoreupload") # e.g. com.krausefx.app

fastlane gems

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

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.4.0
slack-notifier 2.3.2
atomos 0.1.3
CFPropertyList 3.0.2
claide 1.0.3
colored2 3.1.2
nanaimo 0.2.6
xcodeproj 1.15.0
rouge 2.0.7
xcpretty 0.3.0
terminal-notifier 2.0.0
terminal-table 1.8.0
plist 3.5.0
public_suffix 2.0.5
addressable 2.7.0
multipart-post 2.0.0
word_wrap 1.0.0
tty-screen 0.7.1
tty-cursor 0.7.1
tty-spinner 0.9.3
babosa 1.0.3
colored 1.2
highline 1.7.10
commander-fastlane 4.4.6
excon 0.72.0
unf_ext 0.0.7.6
unf 0.1.4
domain_name 0.5.20190701
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
faraday 0.17.3
faraday_middleware 0.13.1
fastimage 2.1.7
gh_inspector 1.1.3
json 2.3.0
mini_magick 4.10.1
multi_xml 0.6.0
rubyzip 1.3.0
security 0.1.3
xcpretty-travis-formatter 1.0.0
dotenv 2.7.5
naturally 2.2.0
simctl 1.6.8
jwt 2.1.0
uber 0.1.0
declarative 0.0.10
declarative-option 0.1.0
representable 3.0.4
retriable 3.1.2
mini_mime 1.0.2
multi_json 1.14.1
signet 0.13.0
memoist 0.16.2
os 1.0.1
googleauth 0.11.0
httpclient 2.8.3
google-api-client 0.36.4
google-cloud-env 1.3.1
google-cloud-errors 1.0.0
google-cloud-core 1.5.0
digest-crc 0.5.1
google-cloud-storage 1.25.1
emoji_regex 1.0.1
uri 0.10.0
unicode-display_width 1.7.0
bundler 2.1.4
aws-eventstream 1.0.3
aws-sigv4 1.1.1
jmespath 1.4.0
aws-sdk-core 2.11.463
aws-sdk-resources 2.11.463
aws-sdk 2.11.463
forwardable 1.3.1
logger 1.4.2
cgi 0.1.0
timeout 0.1.0
stringio 0.1.0
ipaddr 1.2.2
openssl 2.1.2
ostruct 0.2.0
strscan 1.0.3
fiddle 1.0.0
date 3.0.0
delegate 0.1.0
fileutils 1.4.1
etc 1.1.0
zlib 1.1.0
singleton 0.1.0
rexml 3.2.3
open3 0.1.0
yaml 0.1.0
psych 3.1.0
mutex_m 0.1.0

generated on: 2020-03-16

About this issue

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

Most upvoted comments

Created the PR in the google-api-ruby-client project: https://github.com/googleapis/google-api-ruby-client/pull/867 I’ll update on the progress here when it moves forward.

I have the same issue, and I looked into the Google Client ruby code to figure it out.

I have a workaround so I’ll post it here in case it helps other people in the meantime…

I had the google-api-client-0.23.9 gem installed, and I was able to fix the problem by editing the function decode_response_body in the file gems/google-api-client-0.23.9/lib/google/apis/core/api_command.rb at line 79.

For reference, the file in the google client repo (line 84 in that file): https://github.com/googleapis/google-api-ruby-client/blob/master/lib/google/apis/core/api_command.rb

I replaced this block:

        def decode_response_body(content_type, body)
          return super unless response_representation
          return super if options && options.skip_deserialization
          return super if content_type.nil?
          return nil unless content_type.start_with?(JSON_CONTENT_TYPE)
          instance = response_class.new
          response_representation.new(instance).from_json(body, unwrap: response_class)
          instance
        end

with this block (adding 3 lines to change the body if empty from “” to “{}”:

        def decode_response_body(content_type, body)
          return super unless response_representation
          return super if options && options.skip_deserialization
          return super if content_type.nil?
          return nil unless content_type.start_with?(JSON_CONTENT_TYPE)
          instance = response_class.new
          if body.empty?
            body = "{}"
          end
          response_representation.new(instance).from_json(body, unwrap: response_class)
          instance
        end

This fixed the issue for me but I’m not sure if this is the right way to fix it at the moment.

Now for actually fixing the issue, I will send a PR this week in that other code base and link it here so that we can track the progress. Once the other PR is merged I’ll probably have to make a PR for fastlane to update their ruby gem dependencies… If anyone knows how that works please let me know, that will save me some trouble searching, otherwise I’ll figure it out 😃

We see identical error on supply when it tries to delete the existing screenshots and there is none.

Tested this again, and the issue is gone! I haven’t checked in details but my guess is that the bug in the Google Play REST API was fixed. From my perspective it seems we can close this issue, closing my Google ruby code PR now.

My PR on the Google ruby code base hasn’t moved yet… I will try and reproduce the issue again next week to see if the problem is still there. With a bit of luck, the Google Play REST API would have fixed that by now.

No, Google does not offer an API for that - you have to do that by hand @HarminderSinghSandhu

@nzaghini-phorest the issue is not in fastlane understanding the response, but the underlying Google API ruby client parsing it. Unless that’s fixed, we cannot change anything on the fastlane side of things. Feel free to open a pull request and change out the Google API client.