TypeError: Cannot use 'in' operator to search for 'custom' in undefined(…)