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

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

Open

Description

@FezVrasta

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?

Activity

  1. thomasrockhu commented on Mar 2, 2021

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

  2. FezVrasta commented on Mar 2, 2021

    @FezVrasta
    Author

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

  3. tsuz commented on Mar 2, 2021

    @tsuz

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

  4. FezVrasta commented on Mar 3, 2021

    @FezVrasta
    Author

    I can confirm I'm still seeing these errors.

  5. FezVrasta commented on Mar 10, 2021

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

  6. fishactual commented on Mar 14, 2021

    @fishactual

    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.

  7. FezVrasta commented on Mar 14, 2021

    @FezVrasta
    Author

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

  8. tsuz commented on Mar 22, 2021

    @tsuz

    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.

  9. pbassut commented on Apr 25, 2021

    @pbassut

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

  10. anhnguyen1618 commented on Apr 28, 2021

    @anhnguyen1618

    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.

  11. dmail commented on May 21, 2021

    @dmail

    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.

  12. remcohaszing commented on Jun 7, 2021

    @remcohaszing

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

  13. added a commit that references this issue on Jun 16, 2021
  14. thomasrockhu commented on Jul 19, 2021

    @thomasrockhu
    Contributor

    I released 3.8.3 which should help with this issue

  15. added a commit that references this issue on Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions