Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught (in promise) Error: Request failed with status code 426 in React app newsapi call

Tags:

github

reactjs

I have a React app hosted on GitHub that makes a call out to the newsapi.org API. Locally the app is working fine, but in gh-pages URL in some browsers i.e. chrome I am getting the following error which is not allowing the newsapi information to load:

Unchecked runtime.lastError: The message port closed before a response was received.
GET https://newsapi.org/v2/top-headlines?country=us&apiKey=7a4e481d736140efae783b1bfd607fbe 426
createError.js:16 
Uncaught (in promise) Error: Request failed with status code 426
    at e.exports (createError.js:16)
    at e.exports (settle.js:17)
    at XMLHttpRequest.p.onreadystatechange (xhr.js:61)

The repo is at https://github.com/MarkMGill/Newscast, and gh-pages URL is https://markmgill.github.io/Newscast/. I've tried googling 426, but there isn't a lot of useful info I can find. Appreciate anyone who may know how to resolve this.

like image 763
Mr. K Avatar asked Jan 31 '26 22:01

Mr. K


1 Answers

Just researched some more and found new information saying newsapi.org has changed its free service to only allow API calls locally. This explains why my app in gh-pages is no longer loading API info.

like image 117
Mr. K Avatar answered Feb 02 '26 12:02

Mr. K