Unit tests can pass while your webhook receives a different input.
In a self-initiated n8n 2.46.6 demo, the direct function rejected JSON null with OBJECT_REQUIRED. The loopback HTTP route converted null to {} before the Code node, so it rejected the request with...
Fixing a field path is only half a mapping repair.
In a small n8n mapping demo, the input email lived inside the nested body object, but the Code node read a top-level email and called .trim(). The batch stopped before producing either result.