Cannot fetch the games from RAWG's API. ...has been blocked by CORS policy

Hi Everyone,

I’m stuck on video: Project- Building a Video Games Discovery App- Fetching the Games.

here’s the error message showed on the browser:
Access to XMLHttpRequest at ‘’ from origin ‘http://localhost:5173’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Thank you for your help /\


I’ve found the problem.

The problem is on my RAWG’s API account, The Number of requests left for the period is -2412.

I think because I forgot to put dependency when calling useEffect()

You can try creating a new account, don’t forget to add the square brackets in useEffect previously.

I’m having the same issue, i created a new account but looks like its going the same direction.

Could anyone provide a code snippet of the effect hook usage in this project? Or let me know how/why my app is firing so many requests to the API?


Like mentioned above you may not be passing the square brackets[] as an optional second parameter to your effect hook. If you don’t include that it can run infinitely.

in this line?

useEffect( () => {

It’ll be something like useEffect(() => {...}, []);

yep found it, thanks mate!

1 Like