Home > Software design >  Uncaught error using async function with ngrok
Uncaught error using async function with ngrok

Time:09-27

I have the code: async function getUrl() { let url = await ngrok.connect(3000) return url } let url = await getUrl(). I get an uncaught error on the last line. What am I doing wrong? the url variable in both are showing string.

CodePudding user response:

You don't call it with the await keyword.

Rewrite your code as follows:

async function getUrl() { let url = await ngrok.connect(3000) return url } 
let url = getUrl()
  • Related