Issue while invoking lambda on localstack

Issue #61 new
Shashi Upadhyay created an issue

Hi,

I am facing an issue when I am trying to invoke a node js lambda function from CLI.

Below are the steps which I have followed to create and invoke lambda function.

Step 1: I created node js function helloworld.js. Below is it's code snippet.

console.log('Loading function'); exports.handler = function(event, context, callback) { console.log('value1 =', event.key1); console.log('value2 =', event.key2); console.log('value3 =', event.key3); callback(null,"Success");

};

Step 2: Zipped this file as helloworld.zip

Step 3: Create lambda function using the below-mentioned command.

Command: aws --endpoint-url=http://localhost:4574 lambda create-function --region us-east-1 --function-name helloworld --zip-file fileb://helloworld.zip --role arn:aws:iam::000000000000:role/lambda_basic_execution --handler helloworld.handler --runtime nodejs6.10 --profile default --description "SNS X Account Test Function" --timeout 60 --memory-size 128 --environment Variables={LAMBDA_EXECUTOR=docker}

Below is the output of list-function command aws --endpoint-url=http://localhost:4574 lambda list-functions { "Functions": [ { "Version": "$LATEST", "FunctionName": "helloworld", "FunctionArn": "arn:aws:lambda:us-east-1:000000000000:function:helloworld", "Handler": "helloworld.handler", "Timeout": 60, "Runtime": "nodejs6.10" } ] }

Step 4: Tring to invoke lambda function

Content of file://input.txt { "key1": "value1", "key2": "value2", "key3": "value3" }

Command: aws --endpoint-url=http://localhost:4574 lambda invoke --invocation-type RequestResponse --function-name helloworld --region us-east-1 --log-type Tail --payload file://input.txt --profile default outputfile.txt

An error occurred (Exception) when calling the Invoke operation: Error executing Lambda function: Unable to find executor for Lambda function "helloworld". Note that Node cent call last): File "/usr/local/lib/python3.6/site-packages/localstack/services/awslambda/lambda_api.py", line 293, in run_lambda process.run() File "/usr/local/lib/python3.6/multiprocessing/process.py", line 93, in run self._target(self._args, *self._kwargs) File "/usr/local/lib/python3.6/site-packages/localstack/services/awslambda/lambda_api.py", line 289, in do_execute result = func(event, context) File "/usr/local/lib/python3.6/site-packages/localstack/services/awslambda/lambda_api.py", line 367, in generic_handler 'Note that Node.js Lambdas currently require LAMBDA_EXECUTOR=docker') % lambda_name) Exception: Unable to find executor for Lambda function "helloworld". Note that Node.js Lambdas currently require LAMBDA_EXECUTOR=docker

Comments (0)

  1. Log in to comment