Google Places API fetch returns status: 200 but no data

Viewed 130
 const response = await fetch(
    //`https://maps.googleapis.com/maps/api/place/queryautocomplete/json?input=${textInput}&location=${latitude}%${longitude}&key=${apiKey}`,
    //`https://maps.googleapis.com/maps/api/place/queryautocomplete/json?input=pizza%20near%20par&key=${apiKey}`,
    `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=amoeba&types=establishment&location=37.76999%2C-122.44696&radius=500&key=${apiKey}`,
    {}
  );

  console.log("TEST: place response ", JSON.stringify(response));

I couldn't find any related problems on the web, I tried a couple different end points some straight copied from the examples in the documentation but all return the same response:

{
   "type":"default",
   "status":200,
   "ok":true,
   "statusText":"",
   "headers":{
      "map":{
         "server":"scaffolding on HTTPServer2",
         "expires":"Sat, 16 Oct 2021 23:19:04 GMT",
         "server-timing":"gfet4t7; dur=92",
         "content-type":"application/json; charset=UTF-8",
         "alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"",
         "cache-control":"public, max-age=300",
         "x-xss-protection":"0",
         "content-encoding":"gzip",
         "date":"Sat, 16 Oct 2021 23:14:04 GMT",
         "x-frame-options":"SAMEORIGIN",
         "content-length":"526",
         "vary":"Accept-Language"
      }
   },
   "url":"https://maps.googleapis.com/maps/api/place/queryautocomplete/json?input=pizza%20near%20par&key=MY_API_KEY",
   "bodyUsed":false,
   "_bodyInit":{
      "_data":{
         "size":6304,
         "offset":0,
         "blobId":"62109E2F-1D20-473B-94A5-2A3E7C664E9A",
         "type":"application/json",
         "name":"json",
         "__collector":{
            
         }
      }
   },
   "_bodyBlob":{
      "_data":{
         "size":6304,
         "offset":0,
         "blobId":"62109E2F-1D20-473B-94A5-2A3E7C664E9A",
         "type":"application/json",
         "name":"json",
         "__collector":{
            
         }
      }
   }
}

I have Place API enabled in my google developer console. Thanks heaps!

1 Answers
Related