title: Node.JS recursive promise not resolving
body: <p>i'm working with an API that allows me to sync data to a local DB. There is a syncReady API that I'm calling recursively until the sync batch is ready to start sending data. The recursion is working correctly and the .then callback is called, but the resolve function never resolves the response.</p>
  
  <pre><code>const request = require('request-promise');
  const config = require('../Configs/config.json');
  
  function Sync(){}
  
  Sync.prototype.syncReady = function (token, batchID) {
      return new Promise((res, rej) =&gt; {
          config.headers.Get.authorization = `bearer ${token}`;
          config.properties.SyncPrep.id = batchID;
          request({url: config.url.SyncReady, method: config.Method.Get, headers: config.headers.Get, qs: config.properties.SyncPrep})
              .then((response) =&gt; {
                  console.log(`The Response: ${response}`);
                  res(response);
              }, (error) =&gt; {
                  console.log(error.statusCode);
                  if(error.statusCode === 497){
                      this.syncReady(token, batchID);
                  } else rej(error);
              }
          );
      });
  };
  </code></pre>
  
  <p>I get the 497 logged and the "The Response: {"pagesTotal";0}" response but the res(response) never sends the response down the chain. I've added a console.log message along the entire chain and none of the .then functions back down the chain are firing. </p>
  
  <p>I hope I've explained this well enough :-). Any ideas why the promise isn't resolving?</p>
  
  <p>Thanks!</p>