amazon web services - AWS Lambda w/ Node.js Dependencies -


i'm having quite bit of trouble getting node.js lambda script work. i've narrowed down fact script requires 2 nodes.js modules (request , mongojs).

var request = require('request'), mongojs = require('mongojs'), db = mongojs('connection_string_here', ['events']);  exports.handler = function(event, context) {      var data = event.records[0].kinesis.data,         body = new buffer(data, 'base64').tostring('utf-8');      db.events.insert({         event_id: '00030050-0000-1000-8000-30f9ed09e058',         type: {         primary: 'cameradiscovery',         secondary: 'probe'     },     source: {         source_id: '40:16:7e:68:8b:5c',         type: 'envr'     },     payload: body,        created_at: new date(),        last_modified: new date()     }, function(err, doc) {      if (err) return context.fail(err);      context.succeed('processed event');  });  }; 

how 1 ensure dependencies compiled code can execute?

you have create deployment package includes:

  • your script
  • the node_modules modules containing required dependencies

zip them , should work!

source


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -