This message was deleted.
# general
s
This message was deleted.
e
Copy code
const orgAccounts = aws.organizations.getOrganization();

orgAccounts.accounts.forEach(account => {
  console.log(account)
});
^ I thought would work, but get the error
TypeError: Cannot read property 'forEach' of undefined
h
Are you familiar with JavaScript promises?
e
trying to be, definitely my biggest challenge from a python background
I did just create this
Copy code
(async () => {
  const orgs = await aws.organizations.getOrganization();
  orgs.accounts.forEach(account => 
    console.log(account))
})()
but there has to be a more elegant way to do this
h
If that is at top-level (not in a function, module), then unfortunately that's the best way to do it. Nice work!