title: Cloud Functions for Firebase Error: getaddrinfo ENOTFOUND
body: <p>I have request function and tryng to integrate width Cloud Functions for Firebase. </p>
  
  <pre><code>var http = require("https");
  
      function addUserToMailchimpList(email) {
      var options = { method: 'POST',
        url: 'https://usxx.api.mailchimp.com/3.0/lists/xxxxxxx/members/',
        headers: 
         { 'content-type': 'application/json',
           'user' : 'anystring:xxxxxxxxxxxxxxxxxxxxxxx'
         },
  
        body: 
         { email_address: email,
           status: 'subscribed',
         },
        json: true };
  
      request(options, function (error, response, body) {
        if (error) throw new Error(error);
        console.log(body);
        console.log(error);
        console.loh(response);
      });
  
  }
  </code></pre>
  
  <p>Then I am tryng to deploy width this function</p>
  
  <pre><code>exports.sendWelcomeEmail = functions.auth.user().onCreate(event =&gt; {
    const user = event.data; // The Firebase user.
    const email = user.email; // The email of the user.
    const displayName = user.displayName; // The display name of the user.
  
    return addUserToMailchimpList(email);
  });
  </code></pre>
  
  <p>but in firebase functions log I am getting error: </p>
  
  <pre><code>Error: Error: getaddrinfo ENOTFOUND usxx.api.mailchimp.com usxx.api.mailchimp.com:443
  </code></pre>
  
  <p>what I am doing wrong? not undestand.. ?</p>
  
  <p>other method I am tryng to use but same error</p>
  
  <pre><code>function addUserToMailchimpList(email) {
  
    var options = {
      "method": "POST",
      "hostname": "usxx.api.mailchimp.com",
      "port": null,
      "path": "/3.0/lists/xxxxx/members/",
      "headers": {
        "content-type": "application/json",
        "user": "anystring:xxxxxxxxxx",
      }
    };
  
    var req = http.request(options, function (res) {
      var chunks = [];
  
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
  
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
  
    req.write(JSON.stringify({ email_address: email,
      status: 'subscribed',
      merge_fields: { FNAME: 'xxx', LNAME: 'xxx' } }));
    req.end();
  
  }
  </code></pre>