Recently, I created a function to retrieve Google suggestions:
const fetchGoogleSuggestions = async (searchQuery: string) => {
const results = await axios({
url: `https://suggestqueries.google.com/complete/search?client=chrome&q=${searchQuery}`,
adapter: jsonpAdapter,
callbackParamName: "jsonCallback"
});
console.log("test")
return results.data[1];
};
Initially, this function was functioning properly. However, it now appears to be failing without any obvious reason. The console.log
statement does not execute at all. It seems like the promise is refusing to resolve. Strangely, when monitoring the browser's "Network" tab, all requests are being sent and receiving a 200 response code.
I have attempted to troubleshoot by implementing try-catch blocks and using then
to resolve the promise, but nothing seems to work. Can anyone shed some light on this issue?