codecov-action
codecov-action copied to clipboard
Issues uploading Codecov reports
Hi,
until March 20th my Github actions worked fine and codecov uploaded the test coverage as expected. You can find the workflow file that worked until then here.
Some days ago I started working on a PR and suddenly CodeCov throws an error:
[2024-04-14T17:21:24.264Z] ['error'] There was an error running the uploader: Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 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')}
[2024-04-14T17:21:24.265Z] ['verbose'] The error stack is: Error: Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 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')}
at main (/snapshot/repo/dist/src/index.js)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2024-04-14T17:21:24.265Z] ['verbose'] End of uploader: 681 milliseconds
The workflow.yaml stayed unchanged. Also re-trying did not work.
I also tried to follow the quickstart guide and add the environment secret token to GitHub and the yaml and update codecov to version 4 (see here), but I received another error:
/usr/bin/git config --global --add safe.directory /home/runner/work/BlueCast/BlueCast
==> Running command '/home/runner/work/_actions/codecov/codecov-action/v4.2.0/dist/codecov -v create-commit'
/home/runner/work/_actions/codecov/codecov-action/v4.2.0/dist/codecov -v create-commit --git-service github -Z
==> Uploader SHASUM verified (2c9804ba263ba6880d67a671c35388a72fbfe014bd814acd212d8ff38644bf91 codecov)
info - 2024-04-14 20:30:36,760 -- ci service found: github-actions
debug - 2024-04-14 20:30:36,763 -- versioning system found: <class 'codecov_cli.helpers.versioning_systems.GitVersioningSystem'>
debug - 2024-04-14 20:30:36,766 -- versioning system found: <class 'codecov_cli.helpers.versioning_systems.GitVersioningSystem'>
warning - 2024-04-14 20:30:36,769 -- No config file could be found. Ignoring config.
debug - 2024-04-14 20:30:36,769 -- No codecov_yaml found
debug - 2024-04-14 20:30:36,769 -- Starting create commit process --- {"commit_sha": "00f0497da48a96515a410a6a4c438f2ba3a4b816", "parent_sha": null, "pr": null, "branch": "small_version_upgrade", "slug": "ThomasMeissnerDS/BlueCast", "token": "C******************", "service": "github", "enterprise_url": null}
info - 2024-04-14 20:30:36,854 -- Process Commit creating complete
debug - 2024-04-14 20:30:36,854 -- Commit creating result --- {"result": "RequestResult(error=RequestError(code='HTTP Error 401', params={}, description='{\"detail\":\"Github OIDC Token Auth: Invalid token.\"}'), warnings=[], status_code=401, text='{\"detail\":\"Github OIDC Token Auth: Invalid token.\"}')"}
error - 2024-04-14 20:30:36,854 -- Commit creating failed: {"detail":"Github OIDC Token Auth: Invalid token."}
What am I doing wrong?
I think this is an OIDC issue, perhaps if someone on the team can take a look?
Is there any update on this topic? In case it is a bug, when can we expect a fix?
@ThomasMeissnerDS I made a suggestion on your PR that should fix the issue.
Please note, however, that I still see an error after the Codecov step which you will need to handle. https://github.com/thomasrockhu-codecov/BlueCast/actions/runs/8793108313/job/24130447115?pr=1#step:11:88
@thomasrockhu-codecov we've seen this start happening over at google/osv-scanner - we're still on v3 due to how buggy v4 has proven, and coverage has stopped working during April:
[2024-04-26T00:09:29.938Z] ['info']
_____ _
/ ____| | |
| | ___ __| | ___ ___ _____ __
| | / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| | __/ (_| (_) \ V /
\_____\___/ \__,_|\___|\___\___/ \_/
Codecov report uploader 0.7.3
[2024-04-26T00:09:29.945Z] ['info'] => Project root located at: /home/runner/work/osv-scanner/osv-scanner
[2024-04-26T00:09:29.946Z] ['info'] -> No token specified or token is empty
[2024-04-26T00:09:29.955Z] ['info'] Searching for coverage files...
[2024-04-26T00:09:30.014Z] ['info'] Warning: Some files located via search were excluded from upload.
[2024-04-26T00:09:30.015Z] ['info'] If Codecov did not locate your files, please review https://docs.codecov.com/docs/supported-report-formats
[2024-04-26T00:09:30.015Z] ['info'] => Found 1 possible coverage files:
coverage.out
[2024-04-26T00:09:30.015Z] ['info'] Processing /home/runner/work/osv-scanner/osv-scanner/coverage.out...
[2024-04-26T00:09:30.0[70](https://github.com/google/osv-scanner/actions/runs/8840999640/job/24277388006?pr=943#step:5:73)Z] ['info'] Detected GitHub Actions as the CI provider.
[2024-04-26T00:09:30.392Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-3.1.6-uploader-0.7.3&token=*******&branch=support-gradle-dv&build=8840999640&build_url=https%3A%2F%2Fgithub.com%2Fgoogle%2Fosv-scanner%2Factions%2Fruns%2F8840999640&commit=5c7d87bfc3df2c9d546e22e9e59db0adaa4d616e&job=Checks&pr=943&service=github-actions&slug=google%2Fosv-scanner&name=&tag=&flags=&parent=
[2024-04-26T00:09:30.611Z] ['error'] There was an error running the uploader: Error uploading to https://codecov.io: Error: There was an error fetching the storage URL during POST: 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')}
[2024-04-26T00:09:30.611Z] ['info'] Codecov will exit with status code 0. If you are expecting a non-zero exit code, please pass in the `-Z` flag
https://github.com/google/osv-scanner/actions/runs/8840999640/job/24277388006?pr=943
It looks to be happening on just about every pull request though I think I've seen one where it did upload but didn't produce a comment - that includes pull requests from maintainers and pull requests from forks.
Let me know if you'd like a new ticket or any other info.
@G-Rath have you added the token?
Unable to locate build via Github Actions API. Please upload with the Codecov repository upload token to resolve issue.
@thomasrockhu-codecov we've not changed our configuration at all, and this is the latest version of the v3 action - so the coverage file is still in the same place as it's been for months, and no token has been set since it was never needed in the past.
@G-Rath, that is all true. However, due to GitHub's rate-limiting policies, we cannot consistently authenticate a repository without the token.
Ok @thomasrockhu-codecov now we're getting a rate limiting error:
[2024-04-30T05:00:29.506Z] ['error'] There was an error running the uploader: Error uploading to https://codecov.io: Error: There was an error fetching the storage URL during POST: 429 - {'detail': ErrorDetail(string='Rate limit reached. Please upload with the Codecov repository upload token to resolve issue. Expected available in 1185 seconds.', code='throttled')}
That's on https://github.com/google/osv-scanner/pull/948 where we have the token setup - so I'm not sure what we're meant to do now...
@G-Rath ahhh I see. I noticed that you are all on v3, and I would recommend switching to v4. This probably won't fix the issue, but seeing the v4 logs would confirm the issue for me. I am also positive this is this issue
@thomasrockhu-codecov ok we've officially gotten the token set and upgraded to v4, and everything looks mostly fine now except it looks like there might be some weird flakiness - I've had two instances of our macOS job failing due to the token not being found:
info - 2024-05-01 19:00:05,666 -- ci service found: github-actions
warning - 2024-05-01 19:00:05,680 -- No config file could be found. Ignoring config.
Error: Codecov token not found. Please provide Codecov token with -t flag.
Error: Codecov: Failed to properly create commit: The process '/Users/runner/work/_actions/codecov/codecov-action/84508663e988701840491b86de86b666e8a86bed/dist/codecov' failed with exit code 1
https://github.com/google/osv-scanner/actions/runs/8913635448/job/24479567308
The workflow has been running fine for a bunch of other PRs and on main, including for that same job.
I think it might be that it's not correctly detecting its in a fork - comparing to runs like https://github.com/google/osv-scanner/actions/runs/8903206247/job/24450587696?pr=943, it prints that it is using tokenless upload
@G-Rath I released a new version 4.3.1 that I think might have the fix for this. The SHA is 5ecb98a3c6b747ed38dc09f787459979aebb39be
@thomasrockhu-codecov thanks - we've got pinned actions and I'm not a member of the repo so it'll take probably at least a week before I can confirm for sure if this is working; I'll keep you posted.
Also please feel free to get me to open a new "osv-scanner"-based issue at any point - I'm conscious there's a number around that look similar but often have different setups from users, so I'm not sure what the best move is in that regard 😅
@G-Rath all good, perhaps we can open a new one if the fix doesn't work out for you to not pollute @ThomasMeissnerDS's issue
@ThomasMeissnerDS this was been fixed btw, please let me know if it's working for you.
I see a similar problem using the v3:
['error'] There was an error running the uploader: Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 429 - {'detail': ErrorDetail(string='Rate limit reached. Please upload with the Codecov repository upload token to resolve issue. Expected time to availability: 1611s.', code='throttled')}['error'] There was an error running the uploader: Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 429 - {'detail': ErrorDetail(string='Rate limit reached. Please upload with the Codecov repository upload token to resolve issue. Expected time to availability: 1611s.', code='throttled')}
I have the upload token configured but I get the throttled error
@leon1995 I think you're looking for this issue