:5
You’ve misread the error message.
It doesn’t say forEach
is undefined, it says that you are trying to read a property called forEach
from something else which is undefined
.
In this case that something is results["packets"]
.
And it is undefined because the JSON you are getting back from link
doesn’t have the structure you think it does. You need to look at results
(e.g. with console.log(results)
and see what structure it actually has.