Using variables returned from an export function

You copied the code wrong. It is missing the await before the wixData.query

You can replace all the code for the backend with the one I created.