title: Chaining promises in nodejs with request-promise
body: <p>I know there is a lot of stuff out there explaing the concepts but I am still confused why my node.js example does not work.</p>
  
  <p>I have a main function </p>
  
  <pre><code>function main(){
  login()
      .then(
          function(result) {
              return getMyInfo();
          }
      );
  </code></pre>
  
  <p>and two API calls (getMyInfo and login) like this:</p>
  
  <pre><code>function login(){
      const options = {
          ...
          },
      };
      return rp(options);
  }
  </code></pre>
  
  <p>Now I want to call my main function from another file</p>
  
  <pre><code>main()
      .then(
          function(thisIsWhatINeed) {
              console.log(thisIsWhatINeed);
          }
      );
  </code></pre>
  
  <p>Somehow this still returns undefined for me, can you help you finding out why?
  In my opinion both login() and getMyInfo() return a promise and therefore main() also returns a promise because it return getMyInfo..</p>