Sudden 404: Not Found error
Do you want to request a feature or report a bug? Bug
What is the current behavior? Bundlesize returns "Could not add github status. 404: Not Found"
Please mention other relevant information. We've been using bundlesize with Circle CI for months with no issues, but during the night between the 18th and the 19th of September something has broken. We're now getting the above error. I've tried updating and replacing the token ENV var to no avail.
The usual suspects are:
- https://bundlesize-store.now.sh is down (it isn't)
- your GitHub token expired (you replaced it)
- your new token does not have access to add status (?)
- bundlesize hit rate limit for GitHub (i don't think it has enough users yet :P)
GitHub error messages usually give a 404 instead of 401 in cases like this
I'd suggest checking if the token has access, and running bundlesize with --debug flag to see if spots one of the common problems
Running bundlesize with --debug gives me output ending with the following (after displaying all the chunk sizes:
WARN token exists: true
WARN repo: "Onlaw/onlaw.dk"
WARN sha: "f1c43040e6b8ad10122bfb7a22a4b44a2d10d958"
WARN api enabled: true
WARN fetching values: "..."
ERROR Could not add github status.
404: Not Found
Doesn't tell me much. Any ideas?
I have the exact same issue as @denkristoffer, any ideas @siddharthkp ? Using CircleCI.
Regarding
your new token does not have access to add status (?)
How do I check it? @siddharthkp
When I tried to generate the token, although I am being asked my GitHub credentials, I do not see another intermediate screen until https://bundlesize-store.now.sh/auth?code=XYZ site
I'm having the same problem. I've done a bit of digging - I've run bundlesize locally with:
BUNDLESIZE_GITHUB_TOKEN=<my token> CI=true yarn bundlesize --debug
and I've added a line to node_modules/github-build/index.js to log the raw Github response:
{ response:
{ status: 404,
statusText: 'Not Found',
headers: {
'x-ratelimit-limit': '5000',
'x-ratelimit-remaining': '4953',
'x-oauth-scopes': 'repo:status',
'x-accepted-oauth-scopes': '',
...
config: {
method: 'POST',
url:
'https://api.github.com/repos/<my org>/<my repo>/statuses/<commit sha>',
responseType: 'json',
data:
'{"state":"pending","target_url":"<dummy URL>","description":"Checking output size...","context":"bundlesize"}' },
...
data:
{ message: 'Not Found',
documentation_url:
'https://developer.github.com/v3/repos/statuses/#create-a-status' } } }
ERROR Could not add github status.
404: Not Found
I've checked the token's scope:
❯ curl -H "Authorization: token <my token>" https://api.github.com/repos/<my org>/<my repo>/statuses/<commit sha> -I
HTTP/1.1 404 Not Found
X-OAuth-Scopes: repo:status
X-Accepted-OAuth-Scopes: repo, repo:status
❯ curl -X POST -H "Authorization: token <my token>" https://api.github.com/repos/<my org>/<my repo>/statuses/<commit sha> -I
HTTP/1.1 404 Not Found
X-OAuth-Scopes: repo:status
X-Accepted-OAuth-Scopes:
Does anyone know if this means that the token doesn't have permission to update the status?
Does anyone know if this means that the token doesn't have permission to update the status?
Yep, GitHub sends down a 404 if you don't have permission
Yep, GitHub sends down a 404 if you don't have permission
Thanks for the reply! I've authorised the bundlesize Github app, and I've tried selecting "All repositories" and just one repo, and I get the 404 either way. Anything else I can try or any other ideas?
It's difficult to debug from afar 😅
You might to run with the --debug just to make sure the tokens are read.
Same here with Circle CI
I figured out the problem last week! I discovered the bundlesize app (at https://github.com/settings/applications) wasn't granted organisation access to the org the repo was in. Once I granted it access the error went away 🤦♂ 😀
@siddharthkp I don't think this issue should be closed, missing access was never the problem in my case.
Oops, sorry. There was another sub-thread in between.
I just fixed this on our pipeline. The BUNDLESIZE_GITHUB_TOKEN can expire. Github will reply with a 404. Follow the steps here to reset your token: https://github.com/siddharthkp/bundlesize#build-status-for-github
- go here: https://github.com/login/oauth/authorize?scope=repo%3Astatus&client_id=6756cb03a8d6528aca5a
- replace the token in your build tool with the supplied token.
- restart build.
What is the lifetime of this token? A token can not just expire without being automatically refreshed when this is supposed to be embedded into corporate CI workflows.