fetch keeps giving me TypeError: Callback returned incorrect type; expected 'Promise'

I am in the middle of converting my service worker to a module app. I am able to publich but when getting to running it, when it hits:

const resp = await fetch('https://csprng.xyz/v1/api')

I get the following error in my tail logs:

TypeError: Callback returned incorrect type; expected 'Promise'

Would anybody have any idea why this is happening and how to resolve? I am running wrangler 2.8.1

Appreciate the tips
Was this page helpful?