Skip to content

Error executing command when running lambda function #1081

@jamespedid

Description

@jamespedid

Remark: this might be the same issue as: #1055

There is some kind of error that is occurring when trying to run a lambda function using the invoke command from the javascript SDK. Not sure if I'm doing anything wrong. please advise. This works with a live lambda function.

Call from AWS SDK (Javascript)

const { source, identifier } = ctx.params;

const bodyBuffer = await requestToBuffer(ctx.request.req);
const bodyBase64 = bodyBuffer.toString('base64');

const payload = {
        pathParameters: {
            source,
            identifier,
        },
        isBase64Encoded: true,
        body: bodyBase64,
    };
const response = await lambda.invoke({
        FunctionName: 'arn:aws:lambda:us-east-1:000000000000:function:uploadAvatar',
        InvocationType: 'RequestResponse',
        Payload: JSON.stringify(payload),
    }).promise();

Note: I also tried just using uploadAvatar for the function name.

Error Stack Trace returned by Localstack

InternalFailure: Error executing Lambda function: [Errno 7] Argument list too long Traceback (most recent call last):
    File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 301, in run_lambda
      event, context=context, version=version, asynchronous=asynchronous)
    File "/opt/code/localstack/localstack/services/awslambda/lambda_executors.py", line 136, in execute
      result, log_output = self.run_lambda_executor(cmd, environment, asynchronous)
    File "/opt/code/localstack/localstack/services/awslambda/lambda_executors.py", line 58, in run_lambda_executor
      process = run(cmd, asynchronous=True, stderr=subprocess.PIPE, outfile=subprocess.PIPE, env_vars=env_vars)
    File "/opt/code/localstack/localstack/utils/common.py", line 666, in run
      return do_run(cmd)
    File "/opt/code/localstack/localstack/utils/common.py", line 656, in do_run
      stderr=stderr, stdout=stdout_arg, env=env_dict, cwd=cwd)
    File "/opt/code/localstack/.venv/lib/python2.7/site-packages/subprocess32.py", line 825, in __init__
      restore_signals, start_new_session)
    File "/opt/code/localstack/.venv/lib/python2.7/site-packages/subprocess32.py", line 1574, in _execute_child
      raise child_exception_type(errno_num, err_msg)
  OSError: [Errno 7] Argument list too long

Localstack configuration environment variables:

SERVICES=lambda,sns,s3,ses,cloudformation,cloudwatch,apigateway
DEFAULT_REGION=us-east-1
HOSTNAME=cloud
HOSTNAME_EXTERNAL=cloud.dev.leaguegamer.org
LOCALSTACK_HOSTNAME=cloud
USE_SSL=false
LAMBDA_EXECUTOR=docker
DATA_DIR=/tmp/localstack/data
PORT_WEB_UI=8080
LAMBDA_DOCKER_NETWORK=leaguegamer_default

This is running using the localstack/localstack docker image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions