codecov-action: "Unable to locate build via Github Actions API" after switching to v2 action, v1 works fine

After receiving an email about the pending deprecation of the bash uploader, I decided to start migrating my repos to use the v2 uploader.

I tried switching one of my repos to the v2 (binary) uploader: https://github.com/chris48s/django-apiblueprint-view/commit/c029baeccc22fccdb28d7936bab2f135831fa65a

Unfortunately the upload is failing with the error:

['error'] Error POSTing to https://codecov.io: 404 {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}
['error'] There was an error running the uploader: Error uploading to https://codecov.io: Error: Not Found

Full output:

Run codecov/codecov-action@v2
  with:
    file: ./coverage.xml
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.6.15/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.6.15/x64/lib
==> linux OS detected
https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
==> SHASUM file signed by key id 806bb28aed779869
==> Uploader SHASUM verified (d8fe17b4f8cf960b7b02a44067aab92681c7a983bdb9542c64624fc8281dfb80  codecov)
==> Running version latest
==> Running version v0.1.5
/home/runner/work/_actions/codecov/codecov-action/v2/dist/codecov -n  -Q github-action-2.1.0 -f ./coverage.xml
[2021-10-13T17:39:08.177Z] ['info'] 
     _____          _
    / ____|        | |
   | |     ___   __| | ___  ___ _____   __
   | |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
   | |___| (_) | (_| |  __/ (_| (_) \ V /
    \_____\___/ \__,_|\___|\___\___/ \_/

  Codecov report uploader 0.1.5
[2021-10-13T17:39:08.184Z] ['info'] => Project root located at: /home/runner/work/django-apiblueprint-view/django-apiblueprint-view
[2021-10-13T17:39:08.185Z] ['info'] -> No token specified or token is empty
[2021-10-13T17:39:08.190Z] ['info'] Searching for coverage files...
[2021-10-13T17:39:08.203Z] ['info'] => Found 1 possible coverage files:
  ./coverage.xml
[2021-10-13T17:39:08.204Z] ['info'] Processing ./coverage.xml...
[2021-10-13T17:39:08.207Z] ['info'] Detected GitHub Actions as the CI provider.
[2021-10-13T17:39:08.208Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-2.1.0-uploader-0.1.5&token=*******&branch=master&build=1338587511&build_url=https%3A%2F%2Fgithub.com%2Fchris48s%2Fdjango-apiblueprint-view%2Factions%2Fruns%2F1338587511&commit=c029baeccc22fccdb28d7936bab2f135831fa65a&job=Run+tests&pr=&service=github-actions&slug=chris48s%2Fdjango-apiblueprint-view&name=&tag=&flags=&parent=
[2021-10-13T17:39:08.375Z] ['error'] Error POSTing to https://codecov.io: 404 {'detail': ErrorDetail(string='Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.', code='not_found')}
[2021-10-13T17:39:08.376Z] ['error'] There was an error running the uploader: Error uploading to https://codecov.io: Error: Not Found

As I understand the docs, public repos should still be able to upload coverage from GH actions without a token. I switched the repo back to use the v1 (bash) uploader: https://github.com/chris48s/django-apiblueprint-view/commit/77518ba78fc6c558bf435093f7d0ad00fa880267 and that fixes it.

Full output:

Run codecov/codecov-action@v1
  with:
    file: ./coverage.xml
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.6.15/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.6.15/x64/lib
/usr/bin/bash codecov.sh -n  -F  -Q github-action-v1.5.2 -f ./coverage.xml

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-1.0.3


==> git version 2.33.0 found
==> curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
==> GitHub Actions detected.
    Env vars used:
      -> GITHUB_ACTIONS:    true
      -> GITHUB_HEAD_REF:   
      -> GITHUB_REF:        refs/heads/master
      -> GITHUB_REPOSITORY: chris48s/django-apiblueprint-view
      -> GITHUB_RUN_ID:     1338646683
      -> GITHUB_SHA:        77518ba78fc6c558bf435093f7d0ad00fa880267
      -> GITHUB_WORKFLOW:   Run tests
    project root: .
    Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + ./coverage.xml bytes=7556
==> Appending adjustments
    https://docs.codecov.io/docs/fixing-reports
    -> No adjustments found
==> Gzipping contents
        4.0K	/tmp/codecov.VO2yno.gz
==> Uploading reports
    url: https://codecov.io
    query: branch=master&commit=77518ba78fc6c558bf435093f7d0ad00fa880267&build=1338646683&build_url=http%3A%2F%2Fgithub.com%2Fchris48s%2Fdjango-apiblueprint-view%2Factions%2Fruns%2F1338646683&name=&tag=&slug=chris48s%2Fdjango-apiblueprint-view&service=github-actions&flags=&pr=&job=Run%20tests&cmd_args=n,F,Q,f
->  Pinging Codecov
https://codecov.io/upload/v4?package=github-action-v1.5.2-1.0.3&token=secret&branch=master&commit=77518ba78fc6c558bf435093f7d0ad00fa880267&build=1338646683&build_url=http%3A%2F%2Fgithub.com%2Fchris48s%2Fdjango-apiblueprint-view%2Factions%2Fruns%2F1338646683&name=&tag=&slug=chris48s%2Fdjango-apiblueprint-view&service=github-actions&flags=&pr=&job=Run%20tests&cmd_args=n,F,Q,f
->  Uploading to
https://storage.googleapis.com/codecov/v4/raw/2021-10-13/A8B82823B2FC04B2CBA76CF470EF5EC1/77518ba78fc6c558bf435093f7d0ad00fa880267/c57660b7-23a7-4944-be89-a8854e75f288.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EKKHVKCKHW7KBCGM7IHR55T63V2PAVJWLVFNITJHDU5G6R5IRN3LMWJA%2F20211013%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20211013T175743Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=217f3b2e8acbf722d7fd2b58c9dfadc262cd2dc42920f327d266e44ca1d89237
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  1240    0     0  100  1240      0   7337 --:--:-- --:--:-- --:--:--  7337
    -> Reports have been successfully queued for processing at https://codecov.io/github/chris48s/django-apiblueprint-view/commit/77518ba78fc6c558bf435093f7d0ad00fa880267

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 14
  • Comments: 21 (1 by maintainers)

Commits related to this issue

Most upvoted comments

@ssbarnea, what have helped me, and what I thought you suggested was adding token not only to secrets, but to CI yaml as well. Like that:

    - name: Code coverage
      uses: codecov/codecov-action@v3
      with:
        token: ${{ secrets.CODECOV_TOKEN }}

Have you tried it?

I am not sure to which extent this was fixed because lately I seen more and more random errors like this. https://github.com/ansible-community/ansible-lint/runs/5625894991?check_suite_focus=true

TBH, this proved to be a major cause of build failures and the solution would be to make the action itself have an implicit retry logic with delay, maybe even with 5min.

99% of failures are transient and retries would succeed, so I hope they will do the right think and implement that, especially as it is impossible for the consumers to do the same, due to the limitation of workflows.

Same here. Should this issue be reopened as long as this is still affecting users?

In fact is is a good answer. The problem was that the error message does not mention this limitation and the docs are clear: “if is public you do not need a custom token”. Fix these two places and we will know what to do. Just mention that rate limiting for public can produce this error and users will know what to do.

I will start adding the tokens, is not really a bit issue, is just that that is the first time when I know why to docs is misleading. THANKS!

@ssbarnea ,

The issue here is for tokenless uploads to work, we need to use our API token instead of yours. Given how many public repos we support, we hit our rate limit with GitHub fairly often. We have been in discussions on how to handle this, but a retry would not have helped and only made things worse in this case, as I believe that GitHub will extend the delay if you keep making the same request after they tell you no.

Sorry, that’s not an ideal answer.

I seen something very weird in my verbose logs from the pull request, “no token was used or the token was empty”, the change that was adding the line you mentioned. I now updated the token from repository secrets but I doubt it was really empty.

Somehow I suspect that github does not pass the repository secrets for pull requests from forks, as a security measure. Still that token is a weak secret and it is absolutely needed to see the coverage for incoming pull request, probably more important than even measuring it on main branch.

@TomaszZieleskiewicz @drazisil-codecov Apparently we still face random 404 error even after adding CODECOV_TOKEN to repository secrets on a public repository. Example: https://github.com/ansible/ansible-lint/runs/7965627356?check_suite_focus=true

The fact that thing problem was not addressed in years drives will drive people out of codecov. Is not that it was not known, it is just that it was never considered important enough. Why we do not have at least two retries with a delay of 1 or more minutes in between?

It would be acceptable if the failure rate would like 0.1%, but if the failure rate is 2%, that translates to 22% for a pipeline that has 10 uploads, because 1.02^10 ~ 1.22, and that is only due to failure to upload coverage.

I think that the only thing that I can do now is to reconfigure the pipelines to ignore failures of this step. It is dangerous but likely less damaging than getting broken builds due to coverage.

I would not have posted this long comment if it was just yet another random upload failure, it is more than that.

By reading comments from codecov/codecov-action#598, I am wondering if the repository secret might not be available to pull requests coming from forks. Is that true is not really clear which is the right way to reconfigure the jobs.

No wonder that we might get frustrated about a case where docs mention token is not needed for public repos, but in fact it is needed for practical use, but it might not work for some pull requests even when given,…

This issue looks like it is resolved after https://github.com/codecov/uploader/pull/426 was merged and https://github.com/codecov/uploader/releases/tag/v0.1.6 was released.

Ah thanks for the links 👍 I checked for other issues on this repo to see if anyone else had already reported this but I did not know to check on https://github.com/codecov/uploader