Javascript node-fetch synchronous fetch
I think you need to return retrieveLogs function result like this:
async function retrieveLogs(){
return await fetch(url)
.then(res => res.json())
}
As Ali Torki said in comment, fetch()
is an async function and cannot be "made" sync no matter what. If you MUST fetch synchronously with HTTP (e.g. because you MUST use it in a property getter which MUSTN'T be async), then you MUST use a different HTTP client, full stop.