Search code examples
node.jsngrok

Uncaught error using async function with ngrok


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.


Solution

  • 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()