btholt / complete-intro-to-react-v8

The Complete Intro to React, as taught by Brian Holt on Frontend Masters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suddenly getting CORS error from Petfinder api requests

tommytomtj opened this issue · comments

Calls to the Petfinder API are failing (200) and I'm seeing the following error in console:

Access to fetch at 'http://pets-v2.dev-apis.com/pets?animal=&location=&breed=' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disable

I've searched past issues and tried emptying browser cache as well as multiple browsers but I'm still seeing the same error. It was working previously and now I've just started seeing these errors today.

I resolved this by adding "&callback=" to the api calls. Still not entirely sure why this stopped working suddenly.

@tommytomtj We had to migrate the Pet API to another Azure instance last week and there were some configuration issues along the way. Everything should be working now.

Thanks for the update!