These are chat archives for mentum/lambdaws

21st
Apr 2015
Jacques-Olivier D. Bernier
@jackdbernier
Apr 21 2015 00:47
@ac360 Just to be sure. Are you creating the db connection inside the function running on aws lambda?
Austen
@ac360
Apr 21 2015 04:33
@EFF sorry I keep missing you
@jackdbernier sorry to miss you too!
I've put aside the mongoDB issue since I built an app that is using DynamoDB
It's something I've been wanting to work with and since Lambda has DynamoDB support out-of-the-box, I thought I'd build a simple app that uses it
However, I do have one new question
On the start of my node applciation, I'd like to upload the Lambda functions, in case any have changed
I have a directory entitled 'lambda' in my application
I'm wondering if this will work in my main server.js file in node
    /**
    * Lambda Set-Up
    * - Upload all Lambda functions on server start so they are ready to be called
    */
     var λ = require('lambdaws').create;
     fs.readdirSync(path).forEach(function(file) {
          var lambda_function_path = __dirname + '/app/lambda/' + file;
          λ(require(lambda_function_path));
     });
Austen
@ac360
Apr 21 2015 04:38
And is this a best practice?
Austen
@ac360
Apr 21 2015 04:55
I figure it's just better to upload all functions at application start, rather than when they are actually called
Austen
@ac360
Apr 21 2015 05:01
Hmm, running that throws the following error:
   node_modules/lambdaws/lib/zipper.js:66
                var callbackHandler = !!configs.ignoreResponse ? '_emptyCallbackHandle 
   TypeError: Cannot read property 'ignoreResponse' of undefined
Jacques-Olivier D. Bernier
@jackdbernier
Apr 21 2015 21:33
You are missing arguments when calling create. The signature is something like create(handle, deps, config)
It seems like a bug that config does not have a default value since deps is defaulting to []
Though for now if you call it like that λ(require(lambda_function_path), [], {}); is should work.
Thanks for reporting.