HazAT / badge

Add a badge to your app icon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Something went wrong while running badge

Bierrot opened this issue · comments

Hi,

when I run badge through fastlane, I've got this error :

Something went wrong while running badge: `identify /var/folders/62/dklrzf_d1z79pwbykyv57kdc0000gp/T/mini_magick20170728-84089-1iz3pf1.png` failed with error:
identify: improper image header `/var/folders/62/dklrzf_d1z79pwbykyv57kdc0000gp/T/mini_magick20170728-84089-1iz3pf1.png' @ error/png.c/ReadPNGImage/4126.

On my fastfile i've got this :

badge(shield:get_version_number + “-” + get_build_number + “-blue”, custom: “fastlane/badge/black/dev.png”, shield_no_resize:true)

Don't know what to do. Thank's for helping.

I'm getting the same error, any idea @HazAT ? Thanks

We have gotten this error intermittently as well. One suggestion was that my image_magick install might not be the latest (it was not - but updating to the latest via brew did not fix this issue).

I use Fastlane to call the badge function, which uses a mini_magick gem (v4.5.1) to add two badges at the top of the application icons. This combination works most of the time (9 out of 10 times?)

Sometimes, though, the combination produces a failure in parsing what looks like an intermediate PNG. My latest theory is that some combination of the mini_magick gem (v4.5.1) and the badge gem (v0.8.4) might be trying to start a subsequent operation before a previous operation completes?

Here is the rather cryptic and less than totally helpful error message I get:

Something went wrong while running badge: identify /var/folders/57/dhl6f07524q0ygmthfjz4n1h0000gn/T/mini_magick20170812-34515-gelu3n.png failed with error:
identify: improper image header `/var/folders/57/dhl6f07524q0ygmthfjz4n1h0000gn/T/mini_magick20170812-34515-gelu3n.png' @ error/png.c/ReadPNGImage/4232.

Getting exactly same behaviour.

Can't update to the latest version of mini_magick (which is 4.8.0) while using bundle, as getting an error like:

Bundler could not find compatible versions for gem "mini_magick":
  In Gemfile:
    mini_magick (= 4.8.0)

    badge (= 0.8.4) was resolved to 0.8.4, which depends on
      mini_magick (>= 4.5)

    badge (= 0.8.4) was resolved to 0.8.4, which depends on
      fastlane (>= 2.0) was resolved to 2.47.0, which depends on
        mini_magick (~> 4.5.1)

I have the same problem and it happens only sometimes. I try to recognize what raise it and shields.io sometimes respond to image request with a server error, I don't remember error code but it was something like 400 or 500. Then this is saved as png, so image magic can't resize something that is HTML file instead of png. So I think we should add checking request-response and if it is bad then try to repeat request by few times after that if it does not respond correctly then raise an error with right message instead of this unknown error. I will try to do it now and create PR for that.

Ok I recognize error. shields.io respond sometimes with success code 200 and body:

<!doctype html><meta charset=utf-8><title>A server error occurred</title>
<h1> I have nothing to offer for this request </h1>
<p> � but blood, toil, tears and sweat.
</p>
<p>And trying again later.</p>

So probably we need to check after download if downloaded file is image and if isn't then try to download one more time

PR created, also added a way to specify the number of retry times after download problem. Default 10 times. @HazAT

This should be fixed with version 0.8.5 thx @rafalwojcik

I'm using 0.8.5 version but I'm still facing this issue but it is intermittent.