btholt / complete-intro-to-react-v8

The Complete Intro to React, as taught by Brian Holt on Frontend Masters
Apache License 2.0
1.81k stars 201 forks source link

Suddenly getting CORS error from Petfinder api requests #87

Closed tommytomtj closed 10 months ago

tommytomtj commented 10 months ago

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.

tommytomtj commented 10 months ago

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

dtauer commented 10 months ago

@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.

tommytomtj commented 10 months ago

Thanks for the update!