I have a function that returns a value from an API. However, when I use the function within an EJS template, it returns a promise rather than the data. When I console.log (data), it shows the actual data I'm looking for.
Helper
const axios = require("axios");
    const getBrokerName = async (id) => {
        API_BROKERS_URL = `${process.env.API_URL}/api/v1/brokers/?`;
        const params = new URLSearchParams({
            id:id,
            key: process.env.API_KEY,
        });
        
        try {
            const {data} = await axios.get(`${API_BROKERS_URL}${params}`);
            console.log(data.name)
            return data.name
            
        } catch (error) {
            console.log(err)
        }
    }
module.exports = { getBrokerName }
EJS file
<%= helper.getBrokerName(account.broker_id) %>
Result
[object Promise]
What did I miss here?
 
     
    