Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 01 2019 16:35
    praveenvelampudi7 commented #49
  • May 29 2018 19:21
    contractorwolf commented #49
  • May 10 2018 02:55
    deoresheetal commented #49
  • Sep 27 2017 13:25
    contractorwolf unassigned #49
  • Sep 27 2017 13:25
    contractorwolf commented #49
  • May 12 2017 15:22

    EFF on master

    Update README.md (compare)

  • May 12 2017 15:21
    EFF closed #70
  • May 12 2017 15:21
    EFF commented #70
  • May 11 2017 00:04
    Echelonsecretintelligenceofficer commented #70
  • Feb 13 2016 03:45
    vboctor opened #70
  • Jan 13 2016 18:31

    EFF on master

    Update README.md (compare)

  • Dec 11 2015 22:00
    adelevie opened #69
  • Oct 23 2015 15:55
    EFF commented #68
  • Oct 16 2015 18:31
    jakelodwick opened #68
  • Oct 06 2015 15:52
    oortlieb commented #67
  • Oct 06 2015 15:47
    slvnperron commented #67
  • Oct 06 2015 15:34
    oortlieb opened #67
  • Oct 01 2015 04:45
    chrxn commented #66
  • Sep 29 2015 17:00

    slvnperron on master

    Added 'logs:*' as a required pe… Merge pull request #66 from chr… (compare)

  • Sep 29 2015 17:00
    slvnperron closed #66
zulutune
@zulutune

Hey guys,
When I start a new process with require('child_process').spawn I always get "Spawn EACCES".
And when I use require('child_process').execFile, I get "Process exited before completing request".
According to the lambda docs, lambda supports creating processes, and have seen lots of examples doing that. I can't figure out what I am doing wrong. Have a stripped down, simple version which doesn't work either:

var path = require('path'),
      childProcess = require('child_process')
      , fs = require('fs');

exports.handler = function(event, context) {
  console.log('starting handler', event);

  var nodePath = path.join(__dirname, 'node');
  var nodeArgs = [path.join(__dirname, 'hello.js')];

  console.log('calling node: ', nodePath, nodeArgs);

  try {
    var proc = childProcess.spawn(nodePath, nodeArgs);

    proc.stdout.on('data', function (data) {
      console.log(data.toString('utf8'));
    });

    proc.stderr.on('data', function (data) {
      console.log('error  ---:> ' + data);
    });

    proc.on('exit', function (code) {
      console.log('child process exited with code ' + code);
      context.done();
    });

  } catch (e) {
    console.log(e);
    context.done(e, null);
  }


};

Anyone ideas?

I'm using node just as an example here, and it also doesn't work with other binaries.
The file is an executable: "-rwxr-xr-x@ 1 zulutune staff 20231104 Mar 24 03:08 node"
Sylvain Perron
@slvnperron
Hi @zulutune , thanks for your interest in Lambdaws.
Have you had a look into how we invoke external processes with lambdaws?
This works well for us
You may also have a look at Lambdash
Austen
@ac360
Anyone around?
EFF
@EFF
@ac360 sorry to be slow on the keyboard mate got some news ?
or questions ?
Austen
@ac360
@EFF Has anyone been able to connect to an external DB like MongoDB in a Lambda instance using Lambdaws? I'm trying to fire lambdaws with the 'mongodb' dependency and not having much luck.
EFF
@EFF
how do you specify your dependency ?
What do you mean by not having much luck ? Do you have any errors logs in your AWS cloudwatch console ?
Jacques-Olivier D. Bernier
@jackdbernier
@ac360 Just to be sure. Are you creating the db connection inside the function running on aws lambda?
Austen
@ac360
@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
And is this a best practice?
Austen
@ac360
I figure it's just better to upload all functions at application start, rather than when they are actually called
Austen
@ac360
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
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.
Austen
@ac360
@jackdbernier are you around?
Anyone around?
Austen
@ac360
Jack, so it looks like just my code above doesn't actually do anything. The Lambda function is only uploaded when the function is called.
Jacques-Olivier D. Bernier
@jackdbernier
Are sure of it ? It might just feel that way. I did not write that code but from my understanding of it, as soon as you create a "clouded function" the code gets uploaded to aws lambda. Then the first few calls will wait until the upload finishes.
https://github.com/mentum/lambdaws/blob/144a1f0d3b2f7324b6e0587ce5231f9a32eb6e15/lib/LambdaHelper.js#L212 there you can see that the proxy you receive gets the uploadPromise meaning that at some point in time it will finish. It might be useful to resurface that promise somehow to let people get notified for upload completion.
Jacques-Olivier D. Bernier
@jackdbernier
I can be wrong though. Would you mind to share a bigger snippet of code ? You could also try adding a setTimeoutin there just to test it out.
Harry Moreno
@morenoh149
this is looking like a nice tool. Just getting into aws lambda.
Debajyoti Mahanta
@debajyotimahanta
i am using the simple add example but getting the following error
node_modules/lambdaws/lib/lambdaws.js:106
return _lambdaHelper.getCloudedFunctionFromModule(module, handlerName, res
^
TypeError: Cannot read property 'getCloudedFunctionFromModule' of null
Mark Robert Henderson
@aphelionz
Hi, is anybody around? I'm looking for some help with content-type headers in lambda + api gateway.
Robert D. French
@robertdfrench
@aphelionz you wanting to return something other than json?
I think API Gateway tries to assume that anything it gets is a string.
I tried to get a lambda to return html one time and I ended up having to write one of those response transform scripts in API Gateway, and I was able to set the content type there
Robert D. French
@robertdfrench
I dunno if you are the same boat I was, but I put the following mapping template on the integration response for my API method:
#set($inputRoot = $input.path('$')) 
$inputRoot.htmldocument
And then I had my lambda return an object with an 'htmldocument' field containing a string that was my html document
you can set a content-type for integration mappings, so I set 'text/html'
Robert D. French
@robertdfrench
Ooh, I forgot I also had to add an empty Response Model with content-type 'text/html' under Method Response, otherwise it wil still respond with "Content-type: text/json" header. But that was just a lucky guess, and I don't really think it's the right way to accomplish what I set out to do
Carl Schmidt
@cschmidt
Hey @debajyotimahanta did you ever get that error figured out? I'm getting something similar "Cannot read property 'getCloudedFunctionFromFunction'", just running the basic example on a clean install.
Chris Sun
@chrissun-gs
does anyone here have a Lambda function in Python and can return HTTP codes like 400 or 500? I've read various documentation online and created Gateway method responses, integration responses and regular expressions. And I'm raise a Python Exception with a message that matches the regular expession. However, it doesn't seem to work