'CORS error after the second time I send the same get request

This is the line of code that gives me the error:

let obj = await (await fetch(url)).json();

The first time I call the function that runs the code above, everything goes smoothly, I get the JSON response I'm looking for.

The second time I call it in the same browser session however I get:

Access to fetch at **** from origin **** has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I can't work out why. If I refresh the page and try again it works, but if I try once more without refreshing then it fails.

UPDATE: I solved it. the status code for the error I get is 429, which is the Too Many Requests response status code, I have to wait some 20 seconds between a request and another, which is a pain but oh well.



Solution 1:[1]

I solved this issue with this chrome extension

link here

in case upper link does not work then use this link below link 2

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mohit Maroliya B17CS036