Use the "copy path" tools node-red provides to ensure correct path.
There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path to any data item.
Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.
Additionally, use node.warn in your function e.g. node.warn({"msg.area": msg.area}) just before you access it.
Lastly, this is easier with the split and join nodes
That confirms that message contained .area.info.events and it was an array THIS TIME, but as you did see the below error at some point _
_ it suggests a previous msg came through WITHOUT .area resulting in a type error (that is literally what the error says - couldnt read info from undefined i.e. msg.area was undefined & why I said to add node.warn({"msg.area": msg.area}) just before you access it.
If you think there are places a msg could come through that sometimes does NOT have the area property, and that is OK, then you will need to guard against it.
e.g... add a switch node before the function that checks msg.area is type of object OR in your function:
if (!Array.isArray(msg.area?.info?.events)) {
node.error("msg.area.info.events is NOT an array!", msg) // throw catchable error
return null // halt the flow
}
// original code below
// ...
// ...
return msg