ErrorPro / react-google-autocomplete

React components for google places API.
MIT License
473 stars 114 forks source link

Get CORS error when using getPlaceDetails #157

Closed perfectdeed closed 2 years ago

perfectdeed commented 2 years ago

Access to fetch at 'https://maps.googleapis.com/maps/api/place/js/PlaceService.GetPlaceDetails?2sen-US&10e3&14m1&1sChIJL2zGbNcbyUwRro5hONDO1ZE&17m1&2e1&callback=_xdc_._1n8sqd&key=AIzaSyCBnnJKtgJBC2mn4V1PAYDBGULnj3--Jws&token=57751' from origin 'https://app.perfectdeed.dev:4200' 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 disabled.

it's weird, because PlaceService.getDetails is called without error, but then place_impl.js is called another time with a cors error.

Screenshot from 2022-03-22 09-28-09

Or is there a way to get the postal code of in the predictions without having to call placesService.getDetails?

ErrorPro commented 2 years ago

@perfectdeed thats quite strange, it should be the same domain as used by search API. Have you tried to run it without https? Maybe if it's self-signed issue. Let me know if I you still experience this issue