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

Fix bible-api.com CORS issues #258

Closed
tjcouch-sil opened this issue Jun 21, 2023 · 1 comment · Fixed by #276
Closed

Fix bible-api.com CORS issues #258

tjcouch-sil opened this issue Jun 21, 2023 · 1 comment · Fixed by #276
Assignees

Comments

@tjcouch-sil
Copy link
Member

tjcouch-sil commented Jun 21, 2023

Sometimes when hitting the bible-api.com endpoint, we get CORS issues.

Image

TJ:

I think it is possible that the owner of the api added throttling to his api, and we are hitting that throttle limit. We may want to reach out to the owner of the api to discuss the situation with him, just stop using the api (maybe @lyonsil could implement the data provider in C# instead ;) ), or temporarily host our own (seems like overkill). It may be worth discussing what we want to do moving forward.

Ira:

It could just be a throttling issue with the site we are hitting. However, the first error is a CORS issue and it would surprise me if throttling caused that (but it might). If we can demonstrate that it's just a throttling error then this issue is done. Do you have any thoughts on how we could do that? Like, do you get those errors when you are completely offline? If you do and you go back to main before this PR was merged do we still see the same errors when offline?

Hmm... as a data point, I just ran up Rolf's PR#245 and didn't see any of those errors at first. However a restart (trivial change to main.ts) produced one set of the 3 errors. A full restart of npm start produces the errors again.

Created as a result of #177

@tjcouch-sil tjcouch-sil converted this from a draft issue Jun 21, 2023
@tjcouch-sil tjcouch-sil moved this to 📋Product Backlog in Paranext Jun 21, 2023
@tjcouch-sil tjcouch-sil added this to the External Extension Ready milestone Jun 21, 2023
@lyonsil
Copy link
Member

lyonsil commented Jun 26, 2023

Interestingly I don't know that I've ever seen this on Linux, but I do see it in Windows. I looked at the Chrome dev extensions under "Network" to get more information. When I see the problem on Windows there is a status code of 429 (Too Many Requests).

I suspect the problem here is that the 429 isn't getting passed back properly and is incorrectly showing up as a CORS error. It looks like this has happened in other applications.

We could put some time into fixing the CORS logging so that it shows 429 instead of this issue, but the real underlying issue seems like a rate limiting issue to the website. It seems like some identification was made of Chromium apps running on Windows hitting the API a lot, and the server admin put in a block/rate limiter in that situation (or there is some smart infrastructure that made this determination through an algo on its own).

Seems like we should probably just move away from using bible-api.com and use the new USFM data provider. If there is a desire, we could also look into fixing the logging so that 429s get reported properly, too.

@lyonsil lyonsil self-assigned this Jul 3, 2023
@lyonsil lyonsil moved this from 📋Product Backlog to 🏗 In progress in Paranext Jul 3, 2023
@lyonsil lyonsil linked a pull request Jul 3, 2023 that will close this issue
@lyonsil lyonsil moved this from 🏗 In progress to 👀 In review in Paranext Jul 3, 2023
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Paranext Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants