codecov-node
codecov-node copied to clipboard
TypeError: Cannot read property 'startsWith' of undefined
Hi, we run Codecov with npx codecov --token=${CODECOV_TOKEN}
and starting from last week we started seeing these sporadic errors:
==> Building file structure
==> Generating gcov reports (skip via --disable=gcov)
$ find /home/circleci/repo/frontend -type f -name '*.gcno' -exec gcov {} +
Failed to run gcov command.
==> Scanning for reports
+ /home/circleci/repo/frontend/coverage/clover.xml
+ /home/circleci/repo/frontend/coverage/lcov.info
==> Uploading reports
/home/circleci/.npm/_npx/56c18755c3006eff/node_modules/teeny-request/build/src/agents.js:30
var isHttp = uri.startsWith('http://');
^
TypeError: Cannot read property 'startsWith' of undefined
at Object.getAgent (/home/circleci/.npm/_npx/56c18755c3006eff/node_modules/teeny-request/build/src/agents.js:30:22)
at requestToFetchOptions (/home/circleci/.npm/_npx/56c18755c3006eff/node_modules/teeny-request/build/src/index.js:86:30)
at teenyRequest (/home/circleci/.npm/_npx/56c18755c3006eff/node_modules/teeny-request/build/src/index.js:143:14)
at /home/circleci/.npm/_npx/56c18755c3006eff/node_modules/codecov/lib/codecov.js:213:9
at /home/circleci/.npm/_npx/56c18755c3006eff/node_modules/teeny-request/build/src/index.js:233:13
at processTicksAndRejections (node:internal/process/task_queues:94:5)
npm ERR! code 1
npm ERR! path /home/circleci/repo/frontend
npm ERR! command failed
npm ERR! command sh -c codecov "--token="
Running the CI build again usually fixes it, are you aware of the issue?
@FezVrasta I think we were having some issues server-side that had us not returning a proper uri
. Are you still experiencing this issue?
To be clear, we should fix the uploader to be more transparent of the error as opposed to what you saw here, but I wanted to make sure you weren't blocked.
I still experienced this problem yesterday. I'll keep it monitored today. Thanks!
I'm seeing the same error with the same stack trace now... How can we workaround this?
I can confirm I'm still seeing these errors.
Considered Codecov doesn't seem to be interested in fixing this issue I suppose for now I'll go with npx retry-cli -n 3 -- npx codecov --token=${CODECOV_TOKEN}
but we'll likely get rid of codecov all together at some point.
I am running in to this as well. To be honest the Codecov sign up / Github connection / setup process leaves a lot to be desired.
Update, we had to remove it because the retry trick didn't work
This can be worked around by using bash version of codecov so that
codecov -f ./coverage/coverage-final.json
becomes
bash <(curl -s https://codecov.io/bash) -f ./coverage/coverage-final.json
hope this helps.
Having the same issue. If, maybe, they're still investigating the issue, at least a workaround from codecov would be nice.
I had the same problem with codecov nodemodule and decided to dig deeper into the code. The problem in my case is that the token which I am using is invalid. I detected the root problem by logging the result
in this code
https://github.com/codecov/codecov-node/blob/master/lib/codecov.js#L215
. In my case, the root error is:
{'detail': ErrorDetail(string='Could not find a repository associated with upload token <MY_INVALID_TOKEN>', code='not_found')}
even though the error message from codecov
is misleading. Hopefully this tip helps troubleshooting your problems as well.
Also happens in the following circumstances:
- a private repository on GitHub
- Codecov GitHub application configured with public access
Then 100% of the time I get Cannot read property 'startsWith' of undefined
.
I would expect a better error message like Cannot find where to update coverage
, or even please give access to codecov application or use a codecov token
.
I’m seeing this for external GitLab merge requests (for example appsemble/appsemble!1917), but not for internal ones.
I released 3.8.3
which should help with this issue