The provided callback to searchable does not check for errors. Since searchable actually reports errors in addition to reporting data, this has the unfortunate consequence that the forEachSeries callback is called too many times and the file parameter to the iterator ends up as undefined.
The fix is to detect the error and propagate it, not calling the async callback in that case.
The provided callback to searchable does not check for errors. Since searchable actually reports errors in addition to reporting data, this has the unfortunate consequence that the forEachSeries callback is called too many times and the file parameter to the iterator ends up as undefined. The fix is to detect the error and propagate it, not calling the async callback in that case.