Solved the case of the mystery event.
Adding an event to a node appends a line, with node info, to the database file gateway.db.
The event is in the line and shows enabled.
Removing an event from a node appends a node info line to the gateway.db file.
The event is not in the line.
How to create a mystery event.
While the event is still enabled in the node(s) -
delete/remove the event from its location in the metric.js file or other .js file in userMetric.
Restart the gateway.
The database gateway.db still contains the event as enabled for the node(s) even though it no longer exists.
The gateway receives a message from the node(s), the database shows the event as enabled, an attempt to
execute the event is done and it fails as undefined because it does not exist.
To clear the problem -
Delete the gateway.db file which is recreated (or edit it so the nodes don't have to be set up).
Order while destroying events -
1. Remove the event from all nodes, this updates the database.
2. Then delete the event from the file it is in.