I\'ve created a promise function that returns error TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined