upptime / upptime

⬆️ GitHub Actions uptime monitor & status page by @AnandChowdhary
https://upptime.js.org
MIT License
15.43k stars 874 forks source link

summary.json 404s without token query param, causes the upptime Pages web interface to redirect to /error #741

Open mig5 opened 1 year ago

mig5 commented 1 year ago

Describe the bug

All of a sudden I've noticed my upptime is throwing the /error page.

Looking at my browser's dev tools, I see that it tries to load:

https://raw.githubusercontent.com/MYORG/upptime/master/history/summary.json

However, that returns a 404: Not Found by Github.

If I navigate to the actual Github repo, I can access this json file by clicking on it in the web UI in the repository, and then clicking 'Raw' to view the raw file. This time it does not 404 but I notice there's a long token query param appended

https://raw.githubusercontent.com/MYORG/upptime/master/history/summary.json?token=GHS[xxxxxxxxxxxxxxxxxxxxxxxxxx]BEEA

I'm not clear on when this has changed as I had not looked at the UI for a while. The 'statuses' still seem to be working and graph images updating in the web UI itself in Github.

Expected behavior It should load the summary.json and no error page like it used to

Additional context

I should point out that my upptime repository is 'private' in Github, and wondering if this might have something to do with it (has Github added 'tokens' on raw files that are in private repositories?)

AnandChowdhary commented 1 year ago

This is likely because you have a private repository, which means that we can't access its contents. You'll have to set up a proxy for the GitHub API if you want to have a public status page website with a private repository: https://upptime.js.org/docs/configuration/#custom-api-base-url

More details: https://github.com/upptime/upptime/issues/702

mig5 commented 1 year ago

Thanks, but I already am using a proxy, and I have already set that proxy as my apiBaseUrl.

This was working for like 2 years, with a private repo and custom proxy site, and I haven't touched it, and now suddenly something isn't working.

I guess I'll keep looking..

flauc commented 1 year ago

@mig5 @AnandChowdhary It looks like some URL's are no longer going through the configured apiBaseUrl and are hardcoded instead. As a temporary fix I looked up all the "https://raw.githubusercontent.com" in the gh-pages branch and replaced them with my proxy URL. This resolved the issue for me.

AnandChowdhary commented 1 year ago

Good to know! Could you please share which URLs you saw using the incorrect base URL?

flauc commented 1 year ago

Good to know! Could you please share which URLs you saw using the incorrect base URL?

Sadly I don't know I was just finding and replacing in compiled code. Things like o="https://raw.githubusercontent.com/". It was being used like this ("".concat(o,"/").concat(s,"/").concat(l,"/master/history/summary.json"))

marlowl commented 1 year ago

@AnandChowdhary @mig5 noticed the exact same behavior, think it could be related to some of the changes in this commit: https://github.com/upptime/status-page/commit/236fa9bffc8007a01e1a5d886f380c404f758596#diff-94499fd7df57a81f203e8af01c605ec919db004880e391d46ab2d203b9e1fee8 .

Was indeed able to temp fix it with @flauc 's suggestion! 😄