title: Can AWS Lambda reach/interact with S/FTP?
body: <p>I wrote some basic js to just list the files of a FTP but I get:</p>
  
  <p>"Process exited before completing request"</p>
  
  <p>Is that because Lambda can't interact with FTP?</p>
  
  <p>I'm using jsftp btw.</p>
  
  <p>Here's my setup:</p>
  
  <ul>
  <li>I use <a href="https://github.com/serverless/serverless" rel="noreferrer">Serverless</a> to create the project</li>
  <li>For my lambda, I used nodejs and I'm using JSFTP to deal with the ftp stuff.</li>
  </ul>
  
  <p>My code:</p>
  
  <pre><code>// Require Serverless ENV vars
  var ServerlessHelpers = require('serverless-helpers-js').loadEnv();
  
  // Require Logic
  var lib = require('../lib');
  
  // Lambda Handler
  module.exports.handler = function (event, context) {
  
      lib.respond(event, function (error, response) {
          return context.done(error, response);
      });
  };
  </code></pre>
  
  <p>My ftp lambda code:</p>
  
  <pre><code>var JSFtp = require("jsftp");
  
  module.exports.respond = function (event, cb) {
  
      var ftp = new JSFtp({
          host: "host",
          user: "user",
          password: "password"
      });
  
      ftp.auth(ftp.user, ftp.password, function(err, res) {
          if (err) console.log(err);
          else console.log(res);
  
          ftp.ls(".", function (err, res) {
              var results = [];
              res.forEach(function (file) {
                  results.push(file.name);
              });
  
              ftp.raw.quit();
  
              return cb(null, results.length);
          })
      });
  };
  </code></pre>
  
  <p>I added some console.log() all over the place and it seems like it choked once it tried to ftp.auth.</p>
  
  <p>The output I see in cloud watch:</p>
  
  <pre><code>START RequestId: __ID__ Version: $LATEST
  END RequestId: __ID__
  REPORT RequestId: __ID__    Duration: 526.46 ms Billed Duration: 600 ms     Memory Size: 1024 MB    Max Memory Used: 33 MB  
  Process exited before completing request
  </code></pre>
  
  <p>So it looks like it just choked somewhere...</p>