lambda-mailer icon indicating copy to clipboard operation
lambda-mailer copied to clipboard

Path must be a string (received undefined)

Open zetxek opened this issue 8 years ago • 0 comments

Hello,

I'm invoking the function from another lambda. The function is triggered, but the email doesn't succeed:

2017-04-25T00:06:57.273Z	13c6055f-294b-11e7-a972-e75138f1d5c4	TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.join (path.js:1211:7)
at Object.module.exports.run (/var/task/mailer.js:21:26)
at exports.handler (/var/task/index.js:6:10)

The invocation is done as this:

import * as aws from 'aws-sdk'
var lambda = new aws.Lambda();

          var params = {
            FunctionName: 'aws_lambda_mailer-dev',
            InvocationType: 'RequestResponse',
            LogType: 'Tail',
            Payload: '{ test: test }'
          };

          lambda.invoke(params, function(err, data) {
            if (err) {
              context.fail(err);
              console.log('Error sending message: ' + err);
            } else {
              context.succeed('Lambda message: '+ data.Payload);
              console.log('Lambda message: ' + data.Payload);
            }
          })

And in the logs I only get information about an error:

2017-04-25T07:16:05.932Z	04548153-2987-11e7-ac80-8186ddeda411	Lambda message:
{
    "errorMessage": "RequestId: 066b7a6c-2987-11e7-8954-c35459870107 Process exited before completing request"
}

Any idea about why the path might be undefined? When the function is invoked manually (via the test console) the path is found correctly.

zetxek avatar Apr 25 '17 07:04 zetxek