Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All GitHub badges throw error with no token set #2754

Closed
chris48s opened this issue Jan 13, 2019 · 2 comments · Fixed by #9427
Closed

All GitHub badges throw error with no token set #2754

chris48s opened this issue Jan 13, 2019 · 2 comments · Fixed by #9427
Assignees
Labels
developer-experience Dev tooling, test framework, and CI self-hosting Discussion, problems, features, and documentation related to self-hosting Shields

Comments

@chris48s
Copy link
Member

Question

It used to be possible to run your dev copy with no GH_TOKEN set. The allowance is too low to do a full test run, but the anon allowance is enough to render a few badges in the front-end.
Now if no GH_TOKEN is set, all GH badges will fail to render. This is probably unexpected to new/casual contributors.

Is this change intentional, or is it a mistake that has been introduce in the recent work around server secrets/GH auth?

@chris48s chris48s added the question Support questions, usage questions, unconfirmed bugs, discussions, ideas label Jan 13, 2019
@paulmelnikow
Copy link
Member

Yes, this is a usability regression that should be fixed. (I mentioned it in the top post of #2733.) Let’s track it here.

@paulmelnikow paulmelnikow added developer-experience Dev tooling, test framework, and CI and removed question Support questions, usage questions, unconfirmed bugs, discussions, ideas labels Jan 13, 2019
@paulmelnikow paulmelnikow added the self-hosting Discussion, problems, features, and documentation related to self-hosting Shields label Apr 5, 2020
@paulmelnikow paulmelnikow changed the title All GH badges throw error with no token set All GitHub badges throw error with no token set Apr 19, 2020
@chris48s
Copy link
Member Author

chris48s commented Jul 22, 2023

Basically the issue here is that if config.private.gh_token is set, we'll use that. Otherwise, we'll use pooling.

In reality, there should be 3 valid options:

  • config.private.gh_token is set --> use global token
  • config.private.postgres_url is set --> use token pool
  • neither config.private.gh_token nor config.private.postgres_url is set --> use anonymous access

The most important block is here

constructor(config) {
this._debugEnabled = config.service.debug.enabled
this._debugIntervalSeconds = config.service.debug.intervalSeconds
const { postgres_url: pgUrl, gh_token: globalToken } = config.private
if (pgUrl) {
log.log('Token persistence configured with dbUrl')
this.persistence = new SqlTokenPersistence({
url: pgUrl,
table: 'github_user_tokens',
})
}
this.apiProvider = new GithubApiProvider({
baseUrl: config.service.baseUri,
globalToken,
withPooling: !globalToken,
onTokenInvalidated: tokenString => this.onTokenInvalidated(tokenString),
restApiVersion: config.service.restApiVersion,
})
this.oauthHelper = this.constructor._createOauthHelper(config)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer-experience Dev tooling, test framework, and CI self-hosting Discussion, problems, features, and documentation related to self-hosting Shields
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants