code: function schemaCreationWaitLoop(appsyncClient, param, handle, loopCount, callback){
      // spinner.start()
      if(loopCount > maxCloudApiWaitLoop){
          // spinner.stop()
          console.log(chalk.red('exceeded schema creation wait limit'))
          callback({code: maxCloudApiWaitLoop}, handle)
      }else{
          appsyncClient.getSchemaCreationStatus(param, (err, data)=>{
              // spinner.stop()
              if(err){
                  console.log(chalk.red('wait interrupted'))
                  console.log(err)
                  callback({code: 2}, backendDetails)
              }else{
                  handle.schemaCreationResponse = data
                  if(isWaitNeededForSchema(handle)){
                      // spinner.start('status check #' + chalk.blue(loopCount) + ': ' + handle.schemaCreationResponse.status)
                      setTimeout(function(){
                          schemaCreationWaitLoop(appsyncClient, param, handle, loopCount + 1, callback)
                      }, 5000)
                  }else if(handle.schemaCreationResponse.status == 'FAILED'){
                      callback({code: 1}, handle)
                  }else{
                      callback(null, handle)
                  }
              }
          })
      }
  }
docs: const spinner = ora('waiting ... ') //do not move inside function, the function is called recursively