You're making 2 mistakes
- Wrapping the existing promise-related functionality with your own promise (see: What is the explicit promise construction antipattern and how do I avoid it?)
- Mixing async/await with
then
The code can be hugely simplified:
async function LoadBuildId(result) { let url = 'MySecondFancyUrl'; const response = await axios.get(url) result.buildId = response.data; return result; } and
async function LoadBasicData() { let url = 'MyFancyUrl'; let result = Object.create(null); const response = await axios.get(url); result = await LoadBuildId(result); return result; } To be honest, it can be simplified even further - theres no need to be constructing result objects just to set properties on it - you may as well just return the results from a call to axios.get