Skip to content

Couldn't fetch access token for Github application #172

Open

Description

@dguettler

Hi,

I followed the instructions, created a token, made it available as a secret in the application, but I'm running into this error

(node:6456) UnhandledPromiseRejectionWarning: Error: Couldn't fetch access token for Github application. Check if you use the correct `BARECHECK_GITHUB_APP_TOKEN`
    at createGithubAccessToken (/actions-runner/_work/_actions/barecheck/code-coverage-action/v0.6.1/dist/index.js:11291:11)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async createNewAccessToken (/actions-runner/_work/_actions/barecheck/code-coverage-action/v0.6.1/dist/index.js:11011:21)

Any idea what is going wrong here?

Thank you.

Activity

  1. vitaliimelnychuk commented on Apr 26, 2022

    @vitaliimelnychuk
    Member

    Hello @dguettler!

    I am sorry for the issue we have with that version of barecheck. Can you please update barecheck github action to v1?

    Like here: barecheck/code-coverage-action@v1. I will update all docs to use proper version.

  2. dguettler commented on Apr 26, 2022

    @dguettler
    Author
  3. vitaliimelnychuk commented on Apr 26, 2022

    @vitaliimelnychuk
    Member

    Thanks for your feedback @dguettler.

    I am sorry you have faced those problems with action.

    I already fixed the issue here #175. You don't need to update anything, just run your workflow once more and it should pass and post a comment.

    You always are able to use https://www.barecheck.com/ to store results and make comparison with previous executions but it's not required.

    Let me know if you still experiencing any issues.

  4. vitaliimelnychuk commented on Apr 30, 2022

    @vitaliimelnychuk
    Member

    Hello @dguettler!

    Do you still have the issue with action after running action one more time?

  5. andrey-sheremeta commented on May 16, 2022

    @andrey-sheremeta

    Hi @vitaliimelnychuk.

    Thanks a lot for a great job.

    I also faced the similar issue. we used v.0.51 for a while, but the last week it stopped posting the summary commit, after upgrading to v1 (barecheck/code-coverage-action@v1), it throws the error

    Error: Couldn't fetch accessToken token by using appToken. Check if you use the correct `BARECHECK_APP_KEY`
    

    image

    I tried to rerun the job several times, but it did not help.

    Could you please help with this?

  6. vitaliimelnychuk commented on May 16, 2022

    @vitaliimelnychuk
    Member

    Hello @andrey-sheremeta!

    I released v1 as a stable version and will deprecate all previous releases soon. I am sorry that you faced the issue with the old version.

    Can you please try to uninstall and install the application again to get a new token to post comments?

    If it will not help please send here your config of the action. I am more than happy to fix the issue you're facing.

  7. dguettler commented on May 16, 2022

    @dguettler
    Author
  8. vitaliimelnychuk commented on May 16, 2022

    @vitaliimelnychuk
    Member

    Hello @dguettler!

    If you don't have the base coverage report passed it should still post a comment with all uncovered lines but without the comparison part.

    It usually helps to pass base coverage reports or use Barecheck cloud to have diff in percentages.

  9. dguettler commented on May 16, 2022

    @dguettler
    Author

    Hi @vitaliimelnychuk

    this is what I currently get in the logs

    Run barecheck/code-coverage-action@v1
      with:
        barecheck-github-app-token: ***
        lcov-file: coverage/lcov.info
        show-annotations: warning
    lcov-file: coverage/lcov.info
    Current code coverage: NaN%
    Base branch code coverage: 0%
    Code coverage diff: NaN%
    Code coverage diff: NaN%
    minimum-ratio: NaN
    minimum-ratio is disabled for this workflow
    Show annotations feature enabled
    

    There is no comment, but I'm also just testing this on a PR which only adds the check. So not sure if this is or isn't the expected outcome.

  10. dguettler commented on May 16, 2022

    @dguettler
    Author

    This is on a 2nd project

    Run barecheck/code-coverage-action@v1
      with:
        barecheck-github-app-token: ***
        lcov-file: ./osl.info
        show-annotations: warning
    lcov-file: ./osl.info
    Current code coverage: 33.99%
    Base branch code coverage: 0%
    Code coverage diff: 33.99%
    Code coverage diff: 33.99%
    minimum-ratio: NaN
    minimum-ratio is disabled for this workflow
    Show annotations feature enabled
    

    again, no comment. Only change in the PR is adding the actions to run the check.

  11. vitaliimelnychuk commented on May 16, 2022

    @vitaliimelnychuk
    Member

    It's strange that you have NaN% current code coverage. Can you check if the file is properly fulfilled with Lcov data rows?

    Another thing, what do you pass as barecheck-github-app-token? Is it a token received after the Barecheck application installation?

  12. dguettler commented on May 16, 2022

    @dguettler
    Author

    I'll check on the file. Yes it's the token received after installation.

  13. vitaliimelnychuk commented on May 17, 2022

    @vitaliimelnychuk
    Member

    Hello @dguettler!

    Maybe you can also try to uninstall/install Barecheck application to make sure that token is valid.

  14. andrey-sheremeta commented on May 18, 2022

    @andrey-sheremeta

    Hi @vitaliimelnychuk

    We reinstalled the Barecheck application and updated the token, but it did not help.

    attach the config of the action, so you can review it:

    name: Test Coverage Check
    
    on: [pull_request]
    
    jobs:
      base_branch_cov:
        runs-on: ubuntu-latest
    
        strategy:
          matrix:
            node-version: [14.x]
    
        steps:
          - uses: actions/checkout@v2
            with:
              ref: ${{ github.base_ref }}
          - name: Use Node.js ${{ matrix.node-version }}
            uses: actions/setup-node@v1
            with:
              node-version: ${{ matrix.node-version }}
    
          - run: yarn
          - run: yarn test:coverage-cli-report
    
          - name: Upload code coverage for ref branch
            uses: actions/upload-artifact@v2
            with:
              name: ref-lcov.info
              path: ./coverage/lcov.info
    
      checks:
        runs-on: ubuntu-latest
        needs: base_branch_cov
        steps:
          - uses: actions/checkout@v2
          - name: Use Node.js ${{ matrix.node-version }}
            uses: actions/setup-node@v1
            with:
              node-version: ${{ matrix.node-version }}
    
          - name: Download code coverage report from base branch
            uses: actions/download-artifact@v2
            with:
              name: ref-lcov.info
    
          - run: yarn
          - run: yarn test:coverage-cli-report
    
          #  Compares two code coverage files and generates report as a comment
          - name: Generate Code Coverage report
            id: code-coverage
            uses: barecheck/code-coverage-action@v1
            with:
              barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
              lcov-file: './coverage/lcov.info'
              base-lcov-file: './lcov.info'
              minimum-ratio: 10 # Fails Github action once code coverage is decreasing
              show-annotations: 'warning' # Possible options warning|error
    

    Thanks.

  15. vitaliimelnychuk commented on May 19, 2022

    @vitaliimelnychuk
    Member

    Hey @andrey-sheremeta!

    It's really weird. I just added PR to test #184 and it looks fine, not sure what is different on your side. I also did regenerate a token and updated secret with a new one?

    You've got the token from here, right?

    Screenshot 2022-05-19 at 09 14 39

  16. andrey-sheremeta commented on May 30, 2022

    @andrey-sheremeta

    yes, right. we removed and installed the app several times but it did not help. also, we found the sematic pull request stopped working for some reason as well. we think the problem is somewhere in our repo settings, so we will try to fix this issue by ourselves.

    thanks a lot for the help.

  17. vitaliimelnychuk commented on May 30, 2022

    @vitaliimelnychuk
    Member

    @andrey-sheremeta Sure, let me know if you will need any help. This is really weird that you have this access issue.
    Maybe, check if your secrets are passed properly.

  18. dguettler commented on Oct 11, 2022

    @dguettler
    Author
  19. vitaliimelnychuk commented on Oct 11, 2022

    @vitaliimelnychuk
    Member

    Hello @dguettler! Hope you're doing well.

    barecheck-github-app-token - Barecheck application token, received after application installation comment. Basically, this one is just to give access to the Barecheck GitHub application to post comments. You can receive this token after installing the application as I mentioned in the comment above #172 (comment)

    barecheck-api-key - Your project API_KEY generated from https://barecheck.com/. Use this property to avoid running coverage for the base branch. This is an optional field, but some people find it useful to use to avoid rerunning coverage for the base branch and keep historical data stored in Barecheck.

    Let me know if this works for you

  20. aodhgan commented on Jul 23, 2024

    @aodhgan

    @andrey-sheremeta did you ever resolve this? having the same issue

  21. devactivity-app commented on Jul 23, 2024

    @devactivity-app

    @aodhgan, ⭐3 XP earned, 🏆First Comment Added completed!
    Contribute more to raise your XP/Level, complete challenges for extra achievements! [Sign up for personal dashboard]

    icon

  22. vitaliimelnychuk commented on Jul 24, 2024

    @vitaliimelnychuk
    Member

    Hello @aodhgan,

    I am not still aware with what exactly we're having issue here.

    If you look into my comment above about using different tokens, what is the one you're using? if it's barecheck-api-key, did you try to regenerate it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions