Fetch not working after deployment


So this app uses the newsapi.org API to find sports news. It works perfectly fine on localhost, but after deployment to github pages I’m getting a CORS error. This just recently started happening too, I didn’t change anything with my code. Any ideas?

Hi, @Ozark19!

It looks like the trouble here might be caused by limitations in your newsapi.org plan, rather than your code or GitHub Pages.

Viewing your site in the Chrome developer console, I noticed that the error returned used HTTP status code 426 (“Upgrade Required”). The specific error returned was this:

"message":"Requests from the browser are not allowed on the Developer plan, except from localhost."

With that error in mind, it seems you may need to explore your plan options with newsapi.org, in order to enable requests from your published site.

I hope that helps!


FYI I was using the newsapi also when they changed the TOS. I did notice though that Firefox will display the results from your fetch command if that is acceptable.