HazAT / badge

Add a badge to your app icon
MIT License
966 stars 87 forks source link

Something went wrong while running badge #55

Closed Bierrot closed 7 years ago

Bierrot commented 7 years ago

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.

nommis commented 7 years ago

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

wolfe719 commented 7 years ago

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.

sergii-frost commented 7 years ago

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)
rafalwojcik commented 7 years ago

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.

rafalwojcik commented 7 years ago

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

rafalwojcik commented 7 years ago

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

HazAT commented 7 years ago

This should be fixed with version 0.8.5 thx @rafalwojcik

salmojunior commented 7 years ago

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