Secrets manager error returning: [object Promise]

Here’s how I’m using it


import {getSecret} from 'wix-secrets-backend';

export async function send (data) {

const APIkey = getSecret('myAPI')
const url = "https://url.com?key="+APIkey

await fetch(url, { method: 'get' })
.then((httpResponse) => {return httpResponse.json()});

console.log(APIkey) // => {} empty

}

Try this:

const APIkey = await getSecret('myAPI');