i am getting this error “await is only valid in async functions and the top level bodies of modules ” [duplicate]

this is the code i am trying to run but i am getting error as “await is only valid in async functions and the top level bodies of modules “



const url = 'https://instagram-bulk-scraper-latest.p.rapidapi.com/media_info_from_shortcode/CwqI-QTpUG2';
const options =  {
    method: 'GET',
    headers: {
        'X-RapidAPI-Key': '3896965707mshebe233289922e1dp1165bfjsn462757791834',
        'X-RapidAPI-Host': 'instagram-bulk-scraper-latest.p.rapidapi.com'
    }
};

try {
    const response = await fetch(url, options);
    const result = await response.text();
    console.log(result);
} catch (error) {
    console.error(error);
}