Google-api-ruby-client: `upload_image` for `image_type` `icon`

Created on 18 Jun 2019  路  12Comments  路  Source: googleapis/google-api-ruby-client

Noticed the issue June 13th, June 12th was the last day this was working correctly.
I have a feeling this has to do with the June 17th icon changes bring brought in. I'm guessing there was a possible regression that was missed on the Google API

This issue was also mirrored in the widely used open source library fastlane (which I'm not using for my use of the publisher api)
https://github.com/fastlane/fastlane/issues/14914

I also upgraded from publisher_v2 to publisher_v3 to see if this fixed the issue, but it appears the issue affects publisher_v3 as well.

Environment details

  • OS: MacOS Mojave (latest)
  • Ruby version: 2.5.3
  • Gem name and version:
    google-api-client (0.23.9)
      addressable (~> 2.5, >= 2.5.1)
      googleauth (>= 0.5, < 0.7.0)
      httpclient (>= 2.8.1, < 3.0)
      mime-types (~> 3.0)
      representable (~> 3.0)
      retriable (>= 2.0, < 4.0)
      signet (~> 0.9)
    google-cloud-core (1.3.0)
      google-cloud-env (~> 1.0)
    google-cloud-env (1.1.0)
      faraday (~> 0.11)
    google-cloud-storage (1.16.0)
      digest-crc (~> 0.4)
      google-api-client (~> 0.23)
      google-cloud-core (~> 1.2)
      googleauth (>= 0.6.2, < 0.10.0)
    googleauth (0.6.7)
      faraday (~> 0.12)
      jwt (>= 1.4, < 3.0)
      memoist (~> 0.16)
      multi_json (~> 1.11)
      os (>= 0.9, < 2.0)
      signet (~> 0.7)

Steps to reproduce

Used a 512 x 512 32bit PNG

# used imagemagick to identify
identify -verbose groot-32.png | grep bit
  Depth: 8-bit
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
    Alpha: 1-bit
    png:IHDR.bit-depth-orig: 8
    png:IHDR.bit_depth: 8

uploaded using the standard publisher.upload_edit_image but receiving a Server Error without any detailed information.

Code example

           # had these flags on
           Google::Apis::RequestOptions.default.retries = 5
           Google::Apis.logger.level = Logger::DEBUG

            # - created with @publisher = Google::Apis::AndroidpublisherV3::AndroidPublisherService.new
            # - updated edit_id with self.publisher.insert_edit(@package)
            self.publisher.upload_edit_image(
                package_name,
                self.edit_id,
                locale,
                "icon",
                upload_source: path
            )

# Response
Uploading icon: icon.png
D, [2019-06-17T20:23:09.122225 #48466] DEBUG -- : Sending upload start command to https://www.googleapis.com/upload/androidpublisher/v3/applications/com.***.name/edits/00****46/listings/en-US/icon?
D, [2019-06-17T20:23:09.224366 #48466] DEBUG -- : Upload status active
D, [2019-06-17T20:23:09.224496 #48466] DEBUG -- : Sending upload command to https://www.googleapis.com/upload/androidpublisher/v3/applications/com.groot.recollect.waste/edits/00****46/listings/en-US/icon?upload_id=AE****RA&upload_protocol=resumable
D, [2019-06-17T20:23:10.420321 #48466] DEBUG -- : Upload status final
D, [2019-06-17T20:23:10.420628 #48466] DEBUG -- : Error - #<Google::Apis::ServerError: Server error>

D, [2019-06-17T20:23:11.286753 #48466] DEBUG -- : Error - #<Google::Apis::ServerError: Server error>

D, [2019-06-17T20:23:11.286935 #48466] DEBUG -- : Error - #<Google::Apis::ServerError: Server error>

D, [2019-06-17T20:23:12.794153 #48466] DEBUG -- : Error - #<Google::Apis::ServerError: Server error>

D, [2019-06-17T20:23:12.794381 #48466] DEBUG -- : Error - #<Google::Apis::ServerError: Server error>

D, [2019-06-17T20:23:17.105889 #48466] DEBUG -- : Error - #<Google::Apis::ServerError: Server error>

D, [2019-06-17T20:23:17.106188 #48466] DEBUG -- : Error - #<Google::Apis::ServerError: Server error>

D, [2019-06-17T20:23:21.398681 #48466] DEBUG -- : Error - #<Google::Apis::ServerError: Server error>

D, [2019-06-17T20:23:21.398888 #48466] DEBUG -- : Error - #<Google::Apis::ServerError: Server error>

D, [2019-06-17T20:23:45.468666 #48466] DEBUG -- : Error - #<Google::Apis::ServerError: Server error>

D, [2019-06-17T20:23:45.468814 #48466] DEBUG -- : Error - #<Google::Apis::ServerError: Server error>

Server error

All 12 comments

Same issue

I found my problem is that my app was too huge (~34MB) that i need to build an android app bundle instead of apk that is causing Google Api client errors.

Fastfile doesn't seem to support building app bundles (aab extension instead of apk) and i had to manually build (./gradlew bundleRelease, jarsigner) and then upload it with supply command with --aab action (supply supports .aab with fastlane supply --aab app/build/outputs/bundle/release/app.aab)

For information, the relative issue is discussed in Fastlane: https://github.com/fastlane/fastlane/issues/14914

In my case, the recent problem (I observed it as well on Friday June 13rd) seems to be linked to the upload of icon (upload of metadatas and apk work fine in my case)

Seems the problem can be solved as per https://github.com/fastlane/fastlane/issues/14914

I did some more investigation and it looks like it works for this PNG for example
https://smashboards.com/attachments/smashclashicon512-png.17131/

but i haven't been able to get anything successful from output from imagemagick, even though the image is a 32bit PNG.

convert input.png -define png:format=png32 output.png

we noticed that Alpha: 1-bit, so to further thinking Alpha had to be 8-bit, so i tweaked the alpha

convert input.png -channel A -fx .998 -define png:format=png32 output.png

we got Alpha 8-bit but didn't help.

is the API too strict?

What is the file size of the image that is not working?

@sonjz If it works for an image, it's great.
I have a question on the test you made. I tried to upload the PNG https://smashboards.com/attachments/smashclashicon512-png.17131/ as an icon on fastlane 2.125.2 but it does not work. Did you make a test with fastlane or directly with Google API v3 ?

https://github.com/fastlane/fastlane/issues/14914#issuecomment-503299159

suggestion to do a retry until it works fixed the problem, no need for any fancy image manipulation.

simple convert in.png PNG32:out.png works

i just dumped my call into a loop

for x in 1..100
  begin
    puts "RETRY #{x}"
    publisher.upload_edit_image(
      package,
      edit_id,
      'en-US',
      'icon'
      upload_source: path
    )
    break # if we get here it was successful
  rescue => e
    puts "\t\tERROR: #{e.message}")
  end
end

do you think google publisher api is blue/green or canary deploying this change?

@sonjz I confirm that combining "convert in.png PNG32:out.png" and multiple retries works. Nice hack till the issue is solved on Google API side. Thank you !

I noticed that it is just enough to try many times even without calling "convert".

UPDATE: i removed the loop sometime in July, as i noticed it stopped requiring the retry.

Thanks for the update @sonjz ... my read on https://github.com/fastlane/fastlane/issues/14914 is that the issue is resolved in the Google Play backend as of the end of last month. I'm going to close this. Please feel free to reopen if you disagree.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pacuna picture pacuna  路  5Comments

martincalvert picture martincalvert  路  4Comments

davidraj picture davidraj  路  6Comments

penakamaayo picture penakamaayo  路  3Comments

eric-hu picture eric-hu  路  4Comments