Closed johnseekins-pathccm closed 1 year ago
It's hard to tell without seeing all of the code, but the one thought that comes to mind is that const response = await ecsClient.send(command);
is not within an async
function, it's "just out in the main script".
What I mean is I would expect the code to look something like the following:
export default async robot => {
robot.respond(/ecs command (.*)/, async res => {
....
const response await ecsClient.send(command);
})
}
See how the robot.respond
2nd argument is an async
function and the await
call is being done inside that scope? Where is ecsClient.send(command)
being executed in the scope of the script? Is the top level scope? or inside the scope of an async
function?
What you showed me solved my problem. I frequently struggle with JS syntax. Thanks for the help!
I'm trying to add a nice little script so Hubot can show us inventory of some assets. While the general case makes sense, I can't seem to leverage async/await correctly:
Any tips on how to properly use an async function in Hubot?