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

TypeError: Invalid URL on GitHub repo file count badge #7124

Closed
sentry-io bot opened this issue Oct 8, 2021 · 3 comments · Fixed by #7175
Closed

TypeError: Invalid URL on GitHub repo file count badge #7124

sentry-io bot opened this issue Oct 8, 2021 · 3 comments · Fixed by #7175
Labels
core Server, BaseService, GitHub auth, Shared helpers service-badge New or updated service badge

Comments

@sentry-io
Copy link

sentry-io bot commented Oct 8, 2021

Sentry Issue: SHIELDS-6Q

TypeError: Invalid URL: /repos/viralvaghela/HacktoberFest_2021/contents/
  File "/app/core/base-service/node-fetch.js", line 24, in request2NodeFetch
    const nodeFetchUrl = new URL(url)
  File "/app/core/base-service/node-fetch.js", line 79, in AsyncFunction.sendRequest
    const { url: nodeFetchUrl, options: nodeFetchOptions } = request2NodeFetch({
  File "/app/core/base-service/base.js", line 230, in GithubDirectoryFileCount._request
    const { res, buffer } = await this._requestFetcher(url, options)
  File "/app/core/base-service/base-json.js", line 45, in GithubDirectoryFileCount._requestJson
    const { buffer } = await this._request({
  File "/app/services/github/github-directory-file-count.service.js", line 121, in GithubDirectoryFileCount.fetch
    return this._requestJson({
...
(5 additional frame(s) were not displayed)
@chris48s chris48s changed the title TypeError: Invalid URL: /repos/viralvaghela/HacktoberFest_2021/contents/ TypeError: Invalid URL: on GitHub repo file count badge Oct 8, 2021
@chris48s chris48s changed the title TypeError: Invalid URL: on GitHub repo file count badge TypeError: Invalid URL on GitHub repo file count badge Oct 8, 2021
@chris48s chris48s added core Server, BaseService, GitHub auth, Shared helpers service-badge New or updated service badge labels Oct 8, 2021
@chris48s
Copy link
Member

chris48s commented Oct 8, 2021

Example https://img.shields.io/github/directory-file-count/badges/shields

Having deployed #6914 and kept an eye on it for a bit, the only thing that seems to have unexpected broken so far is the GitHub repo file count badge. This is really odd because none of the github badges should be using node-fetch at all. They should all still be using request:

function createRequestFetcher(context, config) {
const { sendAndCacheRequestWithCallbacks, githubApiProvider } = context
return async (url, options) =>
githubApiProvider.requestAsPromise(
sendAndCacheRequestWithCallbacks,
url,
options
)
}

sendAndCacheRequestWithCallbacks: request,

Also I can't reproduce this failure locally. Its only happening in production. I guess somehow we're registering that one service with sendAndCacheRequest rather than sendAndCacheRequestWithCallbacks in prod but not dev. I can't see how though 🤔

@calebcartwright
Copy link
Member

I feel like something funky has been going on with this badge for a while, and whatever we're seeing here probably bears some relation to the behavior we observed in #5967

@chris48s
Copy link
Member

chris48s commented Oct 9, 2021

I'd forgotten about that issue - well remembered.
Still no closer to knowing what's going on though 😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Server, BaseService, GitHub auth, Shared helpers service-badge New or updated service badge
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants