Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

TypeError: Cannot read property 'startsWith' of undefined #284

Open
FezVrasta opened this issue Feb 25, 2021 · 13 comments
Open

TypeError: Cannot read property 'startsWith' of undefined #284

FezVrasta opened this issue Feb 25, 2021 · 13 comments

Comments

@FezVrasta
Copy link

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?

@thomasrockhu
Copy link
Contributor

@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.

@FezVrasta
Copy link
Author

I still experienced this problem yesterday. I'll keep it monitored today. Thanks!

@tsuz
Copy link

tsuz commented Mar 2, 2021

I'm seeing the same error with the same stack trace now... How can we workaround this?

@FezVrasta
Copy link
Author

I can confirm I'm still seeing these errors.

@FezVrasta
Copy link
Author

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.

@fishactual
Copy link

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.

@FezVrasta
Copy link
Author

Update, we had to remove it because the retry trick didn't work

@tsuz
Copy link

tsuz commented Mar 22, 2021

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.

trentm added a commit to elastic/apm-nodejs-http-client that referenced this issue Apr 5, 2021
Because of codecov/codecov-node#284 codecov
reporting is sometimes failing. With the new default node v15 option
of '--unhandled-rejections=strict', this results in the occasional
non-zero exit status, which breaks our node v15 builds. This changes to
ignore that exit status.
trentm added a commit to elastic/apm-nodejs-http-client that referenced this issue Apr 5, 2021
Because of codecov/codecov-node#284 codecov
reporting is sometimes failing. With the new default node v15 option
of '--unhandled-rejections=strict', this results in the occasional
non-zero exit status, which breaks our node v15 builds. This changes to
ignore that exit status.
hyj1991 added a commit to X-Profiler/xprofiler that referenced this issue Apr 19, 2021
@pbassut
Copy link

pbassut commented Apr 25, 2021

Having the same issue. If, maybe, they're still investigating the issue, at least a workaround from codecov would be nice.

@anhnguyen1618
Copy link

anhnguyen1618 commented Apr 28, 2021

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.

@dmail
Copy link

dmail commented May 21, 2021

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.

@remcohaszing
Copy link

I’m seeing this for external GitLab merge requests (for example appsemble/appsemble!1917), but not for internal ones.

@thomasrockhu
Copy link
Contributor

I released 3.8.3 which should help with this issue

brendanashworth added a commit to brendanashworth/generate-password that referenced this issue Jul 22, 2021
brendanashworth added a commit to brendanashworth/generate-password that referenced this issue Jul 22, 2021
brendanashworth added a commit to brendanashworth/generate-password that referenced this issue Jul 22, 2021
fhirfly pushed a commit to veramolabs/ens-did-resolver that referenced this issue Jul 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants