Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Frontend Issue) Unhandled Runtime Error TypeError: Failed to fetch on React and Next JS #21

Open
rayyanekaputra opened this issue Dec 16, 2023 · 0 comments

Comments

@rayyanekaputra
Copy link

in the documentation it is written that is only need to use await without async but it is giving me syntax error, now i put async statement beforehand and suddenly it didnt fetch anything.

const response = async() => await getJson({
engine: "google_scholar_author",
author_id: ZZZ,
api_key: XXX // Get your API_KEY from https://serpapi.com/manage-api-key
});
console.log(response);

i have used the single callback version (without using fetch/async/await) it works but it cant be logged to the browser.. only on my vscode terminal meaning it only works serverside on node js. how am i suppose to pass this to the browser?

getJson(
{
engine: "google_scholar_author",
author_id: ZZZ,
api_key:
XXX,
},
(json) => {
json["articles"].forEach((article) => {
console.log(article.title);
setData((prev) =>[...prev, article.title]);
});
}
);

console.log(data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant