'Immediate functions not running

I have 3 immediate functions declared inside the handler function of an AWS Lambda:

exports.handler = async (event, context, callback) => { 
    (async doFirstStep => {
        console.log("First Step")
    })

    (async doSecondStep => {
        console.log("Second Step")
    })

    (async doThirdStep => {
        console.log("Third Step")
    })
}

When I run the test, the output is as follows:

// INFO First Step

If I change the order of the functions and put the doSecondStep before the doFirstStep then the output is:

// INFO Second Step

The problem is that only one function is executed, any hint on why the other functions are not working as they should be?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source