Github periodically can't load and display codecov badge image

Description

I added a codecov badge to README.md in my public repository as described here.
This is the markdown with the badge:

[![codecov](https://codecov.io/gh/georgysavva/scany/branch/master/graph/badge.svg)](https://codecov.io/gh/georgysavva/scany)

So the badge image URL is https://codecov.io/gh/georgysavva/scany/branch/master/graph/badge.svg
Most of the time it’s displayed correctly, but some times image isn’t loaded at all see pic1.


It happens on different devices and browsers. If I reload the page it displays correctly. BTW, all other badges in the README.md are always displayed correctly.

I managed to catch details of the HTTP response in the browser console when the badge isn’t displayed:

REQUEST HEADERS:
GET /e6b2a12368114c932367001fcf883b3f8f15ff3a/68747470733a2f2f636f6465636f762e696f2f67682f67656f72677973617676612f7363616e792f6272616e63682f6d61737465722f67726170682f62616467652e737667 HTTP/1.1
Host: camo.githubusercontent.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
Accept: image/webp,image/apng,image/,/*;q=0.8
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: no-cors
Sec-Fetch-Dest: image
Referer: GitHub - georgysavva/scany: Library for scanning data from a database into Go structs and more
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8,ru;q=0.7

RESPONSE HEADERS:
HTTP/1.1 404 Not Found
Connection: keep-alive
Content-Length: 24
Cache-Control: no-cache, no-store, private, must-revalidate
Content-Security-Policy: default-src ‘none’; img-src data:; style-src ‘unsafe-inline’
Content-Type: text/plain; charset=utf-8
Server: github-camo (62249a1c)
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block
X-GitHub-Request-Id: AE04:2238:2C8F99:3641DF:5F16C3C8
Accept-Ranges: bytes
Age: 0
Accept-Ranges: bytes
Date: Tue, 21 Jul 2020 10:30:37 GMT
Via: 1.1 varnish
Age: 0
X-Served-By: cache-hel6829-HEL
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1595327435.183196,VS0,VE1879
X-Fastly-Request-ID: 3f0acf8b0fd3a999c0debce97a6b3d0c5dcbe3d0
Timing-Allow-Origin: https://github.com

The response has 404 status. As I understand GitHub uses some Camo proxy and I tried to load the badge image directly from the codecov without the proxy.
I wrote a simple python script that requests the badge image every 10 seconds and 5-10% of requests were failing with a timeout after hanging for more than a minute. I guess this is the problem, in some cases, codecov can’t respond with the badge image within a timeout and Github layer Camo marks it as not found.
I tested codecov badges for other public repositories and it happens for them too, e.g:
https://codecov.io/gh/go-kit/kit/branch/master/graph/badge.svg

Repository

Commit SHAs

master

Codecov YAML

None

To Reproduce

Periodically request the badge image until you receive an error, you can do it via the python script that I used:

import random
import time
from datetime import datetime

import requests

if __name__ == "__main__":
    i = 0
    while True:
        try:
            print("make request %s, at %s" % (i, datetime.now()))
            resp = requests.get(
                "https://codecov.io/gh/georgysavva/scany/branch/master/graph/badge.svg"
            )
            resp.raise_for_status()
        except Exception as e:
            print("Error at %s:%s" % (datetime.now(), e))

        interval = 10.0 + random.randint(0, 10000) / 1000
        time.sleep(interval)
        i += 1
1 Like

Hi @georgysavva, this information is extremely helpful. We are working on getting a fix out for this.

Great. Please ping me when it’s fixed!

Hi @georgysavva, just wanted to update you that we are still working on this. Thanks for your patience!

Hi @georgysavva, just wanted to update that we are getting closer to getting this squared away. Thanks for your patience.

Hi @georgysavva, this should be resolved. Please let me know if you still run into issues here!

Thanks. I will check it out!

1 Like