cannot use require in custom function