You asked your AI to wire up an API. It wrote a fetch call, hit run, and the console says:
Access to fetch at ' https://api.example.com/data ' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present.
Nothing is wrong with your fetch code. This is the browser doing its job.
What CORS actually is
Your page lives on one domain. The API lives on another. The browser asks the API, "Do you allow calls from this page?" If the API doesn't answer yes, the browser refuses — before the API ever sees the request. It's a permission handshake, not a bug in your app.
Why it happens in AI-built apps
Your AI called a third-party API straight from the browser. Most APIs don't allow that.
Your own backend doesn't send the Access-Control-Allow-Origin header.
The API simply never intended browser calls.
The fix
Don't fight the browser. Move the call to your own backend route — a server-side function your frontend calls instead.…