await / getsecret() function

Hi, I’ve just discovered the secrets manager and trying to use it. I followed the example showed in this link to the letter and I’m getting the " Parsing error: Can not use keyword ‘await’ outside an async function " error… am I missing something?

Below is the code as appears in the example, it seems it is used outside of a function - right after the import part.

import {getSecret} from'wix-secrets-backend'; 
//...
const mySecret = await getSecret("myApiKeyName");

Any thoughts/ best practice? I am using it in backend and would like to avoid using it in a fucntion.

Thank, Assaf

wrap it with

export function XXX () {
//…add something

}

export async function getSecret () {

const mySecret = await getSecret ( “myApiKeyName” );
return mySecret

}