title: request(...).then is not a function error when making a POST request
body: <p>I'm trying to create a firebase function that makes a HTTP POST request whenever a new document is created.</p>
  
  <p>This is my code:</p>
  
  <pre><code>import * as functions from 'firebase-functions';
  
  const admin = require('firebase-admin');
  
  const request = require("request");
  
  
  exports.sendMessage = functions.firestore.document('comms/{comms}').onCreate((snap, context) =&gt; {
  
  
    const newValue = snap.data();
  
    if (newValue) {
  
      //const email = newValue.email;
      const msg = newValue.msg;
  
  
      return request({
        uri: "url",
        method: 'POST',
        body: msg,
        json: true,
        resolveWithFullResponse: true
      }).then((response: { statusCode: number; }) =&gt; {
        if (response.statusCode &gt;= 400) {
          throw new Error(`HTTP Error: ${response.statusCode}`);
        }
        console.log('SUCCESS! Posted', msg);
      });
  
    }
  
   return Promise 
  });
  </code></pre>
  
  <pre><code>Error received:
  
  </code></pre>
  
  <p>TypeError: request(...).then is not a function
      at exports.sendMessage.functions.firestore.document.onCreate (/srv/lib/index.js:25:12)
      at cloudFunction (/srv/node_modules/firebase-functions/lib/cloud-functions.js:127:23)
      at /worker/worker.js:825:24
      at 
      at process._tickDomainCallback (internal/process/next_tick.js:229:7)</p>