Hi, I’m trying to use a Google API to create an autocomplete address field but I keep on getting the same error. I literally copied and pasted a url from google documentation to try narrow down the problem and that returns the exact same error. My code is:
let sUrl = "https://maps.googleapis.com/maps/api/place/autocomplete/json?input=1600+Amphitheatre&key=mykey";
return fetch(sUrl, {method: 'get'}).then( (httpResponse) => { console.log("sent"); if (httpResponse.ok) { console.log((httpResponse.json) + "response recieved"); return httpResponse.json();
and the error I’m getting back is:
var self = this; return this._decode().then(function(buffer) { try { return JSON.parse(buffer.toString()); } catch (err) { return Body.Promise.reject(new FetchError('invalid json response body at ' + self.url + ' reason: ' + err.message, 'invalid-json')); } });
Any ideas why this is happening? Its doing my head in
Thanks,