title: Unable to send SMS through Twilio and Google Functions
body: <p>I am attempting to send a text (a one-time pass code) using Twilio, firebase and Google Functions, and using Postman. </p>
  
  <p>I have run $ npm install --save twilio@3.0.0 -rc.13 in the functions directory.</p>
  
  <p>When I run $ firebase deploy, it completes. But on Postman, when I do POST, Body and feed a JSON { "phone": "555-5555" }, I get an "Error: could not handle the request."</p>
  
  <p>I am able to send a text in Twilio Programmable SMS from my Twilio number to an actual outside number direct to the mobile phone. I'm using live credentials for Sid and AuthToken.</p>
  
  <p>Is this an issue with Twilio, Google Functions and some configurations?</p>
  
  <p>Here are the logs on Functions:</p>
  
  <p>// White flag sign// 
  Function execution took 1452 ms, finished with status: 'crash'</p>
  
  <p>//Red Warning sign//
  TypeError: handler is not a function
      at cloudFunction (/user_code/node_modules/firebase-functions/lib/providers/https.js:26:41)
      at /var/tmp/worker/worker.js:676:7
      at /var/tmp/worker/worker.js:660:9
      at _combinedTickCallback (internal/process/next_tick.js:73:7)
      at process._tickDomainCallback (internal/process/next_tick.js:128:9)</p>
  
  <p>Also, the google eslint forces consistent-return, which is why I put "return;" in the request-one-time-password.js. I cannot seem to turn it off by adding "consistent-return": 0 in eslintrc.</p>
  
  <p>My code(with secret keys and phone numbers redacted):</p>
  
  <pre><code>//one-time-password/functions/service_account.js
  has my keys copied and pasted.
  
  //one-time-password/functions/twilio.js
  
  
  const twilio = require('twilio');
  
  const accountSid = 'redacted';
  const authToken = 'redacted';
  
  module.exports = new twilio.Twilio(accountSid, authToken);
  
  //one-time-password/functions/request-one-time-password.js
  
  const admin = require('firebase-admin');
  const twilio = require('./twilio');
  
  module.export = function(req, res) {
    if(!req.body.phone) {
      return res.status(422).send({ error: 'You must provide a phone number!'});
    }
    const phone = String(req.body.phone).replace(/[^\d]/g, '');
  
    admin.auth().getUser(phone).then(userRecord =&gt; {
        const code = Math.floor((Math.random() * 8999 + 1000));
      // generate number between 1000 and 9999; drop off decimals
      twilio.messages.create({
        body: 'Your code is ' + code,
        to: phone,
        from: '+redacted'
      }, (err) =&gt; {
        if (err) { return res.status(422).send(err); }
  
        admin.database().ref('users/' + phone).update({ code: code, codeValid: true }, () =&gt; {
          res.send({ success: true });
        })
    });
  return;
    }).catch((err) =&gt; {
      res.status(422).send({ error: err })
    });
  }
  
  /////////////////////////////////
  //one-time-password/functions/index.js
  
  const admin = require('firebase-admin');
  const functions = require('firebase-functions');
  const createUser = require('./create_user');
  const serviceAccount = require('./service_account.json')
  const requestOneTimePassword = require('./request_one_time_password');
  
  admin.initializeApp({
    credential: admin.credential.cert(serviceAccount),
    databaseURL: "https://one-time-password-650d2.firebaseio.com"
  });
  
  exports.createUser = functions.https.onRequest(createUser);
  
  exports.requestOneTimePassword = 
  functions.https.onRequest(requestOneTimePassword);
  </code></pre>