This is a pretty standard mistake that javascript developers make and isn't related to hyperledger composer at all.
You are trying to perform an await
within a method that hasn't been declared async
. HOWEVER even if you do add the keyword async
to the method that you have declared inside the forEach
declaration it still won't work, due to the way forEach works.
So for you the solution is, don't use the forEach method of an array to try to run an anonymous function with an await
in it. Use an alternative method to iterate the allTransactions array such as a for loop.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…