title: Wait for Bluebird promise to resolve before continuing
body: <p>I'm using an NPM package called <a href="https://github.com/not-an-aardvark/snoowrap" rel="nofollow noreferrer">snoowrap</a>, that accesses the Reddit API. It returns results, such as from searches, as Bluebird promises. </p>
  
  <p>I have file <code>reddit.js</code> like this:</p>
  
  <pre><code>const snoowrap = require('snoowrap');
  
  function getFirstSearchResultUrl() {
    // Actual Reddit API credentials not included.
    const r = new snoowrap({
      userAgent,
      clientId,
      clientSecret,
      username,
      password,
    });
  
    return r
      .search({
        query: 'query',
        subreddit: 'askreddit',
      })
      .then((posts) =&gt; {
        return posts[0].url;
      });
  }
  
  const resultUrl = getFirstSearchResultUrl();
  console.log(resultUrl);
  </code></pre>
  
  <p>But <code>console.log</code> prints <code>[chainable Promise]</code> rather than the URL that is returned.</p>
  
  <p>How can I get it to print the URL that was returned, instead of the promise? I looked through the docs and tried different Bluebird methods like <code>.reflect()</code> and <code>.settle()</code> but they didn't seem to work for me.</p>
  
  <p>Is it possible to prevent the rest of the script from executing until the promise is completed?</p>