Giter Club home page Giter Club logo

aws-lambda-runtime-interface-emulator's Introduction

AWS Lambda Runtime Interface Emulator

GitHub release (latest by date) GitHub go.mod Go version GitHub

The Lambda Runtime Interface Emulator is a proxy for Lambda’s Runtime and Extensions APIs, which allows customers to locally test their Lambda function packaged as a container image. It is a lightweight web-server that converts HTTP requests to JSON events and maintains functional parity with the Lambda Runtime API in the cloud. It allows you to locally test your functions using familiar tools such as cURL and the Docker CLI (when testing functions packaged as container images). It also simplifies running your application on additional computes. You can include the Lambda Runtime Interface Emulator in your container image to have it accept HTTP requests instead of the JSON events required for deployment to Lambda. This component does not emulate Lambda’s orchestrator, or security and authentication configurations. You can get started by downloading and installing it on your local machine. When the Lambda Runtime API emulator is executed, a /2015-03-31/functions/function/invocations endpoint will be stood up within the container that you post data to it in order to invoke your function for testing.

Content

Installing

Instructions for installing AWS Lambda Runtime Interface Emulator for your platform

Platform Command to install
macOS/Linux x86_64 mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && chmod +x ~/.aws-lambda-rie/aws-lambda-rie
macOS/Linux arm64 mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-arm64 && chmod +x ~/.aws-lambda-rie/aws-lambda-rie
Windows x86_64 Invoke-WebRequest -OutFile 'C:\Program Files\aws lambda\aws-lambda-rie' https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie
Windows arm64 Invoke-WebRequest -OutFile 'C:\Program Files\aws lambda\aws-lambda-rie' https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-arm64

Getting started

There are a few ways you use the Runtime Interface Emulator (RIE) to locally test your function depending on the base image used.

Test an image with RIE included in the image

The AWS base images for Lambda include the runtime interface emulator. You can also follow these steps if you built the RIE into your alternative base image.

To test your Lambda function with the emulator

  1. Build your image locally using the docker build command.

    docker build -t myfunction:latest .

  2. Run your container image locally using the docker run command.

    docker run -p 9000:8080 myfunction:latest

    This command runs the image as a container and starts up an endpoint locally at localhost:9000/2015-03-31/functions/function/invocations.

  3. Post an event to the following endpoint using a curl command:

    curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'

    This command invokes the function running in the container image and returns a response.

Build RIE into your base image

You can build RIE into a base image. Download the RIE from GitHub to your local machine and update your Dockerfile to install RIE.

To build the emulator into your image

  1. Create a script and save it in your project directory. Set execution permissions for the script file.

    The script checks for the presence of the AWS_LAMBDA_RUNTIME_API environment variable, which indicates the presence of the runtime API. If the runtime API is present, the script runs the runtime interface client. Otherwise, the script runs the runtime interface emulator.

    The following example shows a typical script for a Node.js function.

    #!/bin/sh
    if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then
      exec /usr/local/bin/aws-lambda-rie /usr/bin/npx aws-lambda-ric
    else
      exec /usr/bin/npx aws-lambda-ric
    fi
  2. Download the runtime interface emulator for your target architecture (aws-lambda-rie for x86_64 or aws-lambda-rie-arm64 for arm64) from GitHub into your project directory.

  3. Install the emulator package and change ENTRYPOINT to run the new script by adding the following lines to your Dockerfile:

    To use the default x86_64 architecture

    ADD aws-lambda-rie /usr/local/bin/aws-lambda-rie
    ENTRYPOINT [ "/entry_script.sh" ]

    To use the arm64 architecture:

    ADD aws-lambda-rie-arm64 /usr/local/bin/aws-lambda-rie
    ENTRYPOINT [ "/entry_script.sh" ]
  4. Build your image locally using the docker build command.

    docker build -t myfunction:latest .
  5. Run your image locally using the docker run command.

    docker run -p 9000:8080 myfunction:latest

Test an image without adding RIE to the image

You install the runtime interface emulator to your local machine. When you run the container image, you set the entry point to be the emulator.

To test an image without adding RIE to the image

  1. From your project directory, run the following command to download the RIE (x86-64 architecture) from GitHub and install it on your local machine.

    mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie \
    https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie \
    && chmod +x ~/.aws-lambda-rie/aws-lambda-rie

    To download the RIE for arm64 architecture, use the previous command with a different GitHub download url.

    https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-arm64 \
    
  2. Run your Lambda image function using the docker run command.

    docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 myfunction:latest \
        --entrypoint /aws-lambda/aws-lambda-rie  <image entrypoint> <(optional) image command>

    This runs the image as a container and starts up an endpoint locally at localhost:9000/2015-03-31/functions/function/invocations.

  3. Post an event to the following endpoint using a curl command:

    curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'

    This command invokes the function running in the container image and returns a response.

How to configure

aws-lambda-rie can be configured through Environment Variables within the local running Image. You can configure your credentials by setting:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_SESSION_TOKEN
  • AWS_REGION

You can configure timeout by setting AWS_LAMBDA_FUNCTION_TIMEOUT to the number of seconds you want your function to timeout in.

The rest of these Environment Variables can be set to match AWS Lambda's environment but are not required.

  • AWS_LAMBDA_FUNCTION_VERSION
  • AWS_LAMBDA_FUNCTION_NAME
  • AWS_LAMBDA_FUNCTION_MEMORY_SIZE

Level of support

You can use the emulator to test if your function code is compatible with the Lambda environment, executes successfully and provides the expected output. For example, you can mock test events from different event sources. You can also use it to test extensions and agents built into the container image against the Lambda Extensions API. This component does not emulate the orchestration behavior of AWS Lambda. For example, Lambda has a network and security configurations that will not be emulated by this component.

  • You can use the emulator to test if your function code is compatible with the Lambda environment, runs successfully and provides the expected output.
  • You can also use it to test extensions and agents built into the container image against the Lambda Extensions API.
  • This component does not emulate Lambda’s orchestration, or security and authentication configurations.
  • The component does not support X-ray and other Lambda integrations locally.
  • The component supports only Linux, for x86-64 and arm64 architectures.

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

aws-lambda-runtime-interface-emulator's People

Contributors

amazon-auto avatar astahlman avatar dependabot[bot] avatar jacobwgillespie avatar jfuss avatar jjc1138 avatar jordan-brough avatar mbfreder avatar mcieno avatar roger-zhangg avatar seshubaws avatar sjansen avatar valerena avatar wchengru avatar wkirschenmann avatar yeongrokgim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-lambda-runtime-interface-emulator's Issues

How to invoke a function with custom client context?

On AWS, I'm using Lambda function which receives event data and custom client context. For local testing, I want to run curl and invoke function with custom client context, defined as:

ClientContext string `json:"Client-Context"`

I dug into codes, and found aws-lambda-rie seems not to add client context to a invoke payload:

invokePayload := &interop.Invoke{
ID: uuid.New().String(),
InvokedFunctionArn: fmt.Sprintf("arn:aws:lambda:us-east-1:012345678912:function:%s", GetenvWithDefault("AWS_LAMBDA_FUNCTION_NAME", "test_function")),
TraceID: r.Header.Get("X-Amzn-Trace-Id"),
LambdaSegmentID: r.Header.Get("X-Amzn-Segment-Id"),
Payload: bytes.NewReader(bodyBytes),
CorrelationID: "invokeCorrelationID",
}

So, is there any ways to use custom client context with aws-lambda-rie? Should I send a pull request for this? It seems that Lambda-Runtime-Client-Context header is related to this, but I cannot find a way to use it properly.

Environment: I'm using aws-lambda-rie command in public.ecr.aws/lambda/nodejs:18.2022.12.02.19 image (https://gallery.ecr.aws/lambda/nodejs). Locally, I confirmed my function implementation can receive event data by running curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"payload":"hello world!"}', but cannot receive client context by adding Lambda-Runtime-Client-Context header like -H 'Lambda-Runtime-Client-Context: { "foo":"bar" }'. On AWS, my function can receive custom client context.

logs not showing correctly when using sam

Description
When using sam invoke, the output of console.log is not displayed correctly as described in this issue.

Steps to reproduce
console.log('line one\rline two\rline three\nline four\nline five')

will output

START RequestId: ac1ef293-d504-16a9-6b21-20a04c7f98e6 Version: $LATEST
line fiveeT14:12:51.527Z ac1ef293-d504-16a9-6b21-20a04c7f98e6 INFO line one
END RequestId: ac1ef293-d504-16a9-6b21-20a04c7f98e6

and
console.log(json.stringify({one: 'line one', two: 'line two', three: 'line three', four: 'line four'}, null, 2))
is just as problematic. One can only read the first and last lines, usually { and }

According to @mhart

This is due to some unfortunate internal changes in the runtimes where console.log is overwritten by a function that transforms all newlines to \r.

Additional environment details
os: OSX 10.14.6
sam cli versions tested: 1.3.0, 1.12.0, 1.13.2

Is it possible to test LambdaFunctionURL lambdas with aws-lambda-rie ?

I have a 2 lambdas:

  • One that take a CloudWatchEvent as the second argument of the Handle()function
  • One that take a LambdaFunctionURLRequestas the second argument of the Handle()function

I'm able to successfully test with aws-lambda-riethe first Lambda but not the second one

Even with a quite naive handler:

func  Handle(ctx context.Context, request events.LambdaFunctionURLRequest) error {
  log.Printf("body: %s", request.RawPath)
  return nil
}

Is it possible to test this "new" kind of lambdas using aws-lambda-runtime ? Am I doing something wrong ?

release binaries that work on mac

Would be nice to have binaries included on a release that target Mac.

For now I had to change the Makefile to build for GOOS=darwin as a work around.

RIE not working on debian with no output

Hi,
I am trying to create a python lambda on debian using the python:3.8-buster as docker base. When i tried using the rie I've got no success and no error reported why it's not working. The simplest example i could find to reproduce is simply running the base debian image with the RIE mounted in:

docker run -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 \ 
    --entrypoint /aws-lambda/aws-lambda-rie \
        -t python:3.8-buster --log-level debug  python -m awslambdaric entry.handler

I get the output

INFO[0000] exec 'python' (cwd=/, handler=entry.handler)
DEBU[0000] Runtime API Server listening on 127.0.0.1:9001

I would expect to get some error (for example that awslambdaric is not installed). It behaves the same when I mistype python to let's say pymton - no error reported.

Running docker exec angry_proskuriakova ps -A shows rie running

  PID TTY          TIME CMD
    1 pts/0    00:00:00 aws-lambda-rie
   12 ?        00:00:00 ps

After ctrl-C it exits correctly so I assume that rie is still running, but silently failed running the lambda

INFO[0211] Received signal                               signal=interrupt
INFO[0211] Shutting down...
DEBU[0211] Canceling flows: errResetReceived
WARN[0211] Reset initiated: SandboxTerminated
DEBU[0211] Dispatching DONE:resetCorrelationID

Could you please confirm that this is happening or tell me what I'm doing wrong?

opensource rapidcore

It seems much of the functionality of this emulator is based on go.amzn.com/lambda/rapidcore which appears to be private

Is this something that can be open-sourced as well?

Runtime init reload after panic

Some runtimes crash with panics because they assume the environment will self recover, because that's Lambda's behavior when you deploy a function. It'd be very useful if the emulator would initialize the runtime again if the runtime crashed with a panic.

Otherwise, people have to restart the emulator, and it's not very obvious that you have to do that by looking at the logs either.

Async (Event) Function Invocation Emulation?

Hello there! First off, thank you for making this emulator, it is really helpful for testing and development.

My question: is there a way to run the function invocation asynchronously? As far as I can tell, right now the HTTP request to the emulator results in a blocking call (i.e. no HTTP response until the function completes). This is helpful for testing the RequestResponse invocations, but causes issues with code using Event invocations (https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_RequestSyntax).

In other words, I would expect the follow curl command to return almost immediately even if the "lambda" started takes a few minutes to complete.

curl -v -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -H "X-Amz-Invocation-Type: Event" -d '{}'

Not having this unfortunately breaks code that relies on the Event (async) behavior. We can of course thread/async those calls in our code, but it breaks the emulation we were hoping for.

Am I missing something, or is this indeed currently not covered by the emulator? If not covered, would a pull request to add it be welcome?

Thanks.

Support X-Ray locally

According to the README:

The component does not support X-ray and other Lambda integrations locally.

So...how hard would it be to add this support for local X-Ray integration?

I think the primary use case for this would be to allow functions built with the SAM CLI that utilize X-Ray (e.g., with AWSXRay.captureAWSv3Client) to run locally. Not having this integration requires annoying hacks to import or not import the X-Ray SDK based on where the function is deployed. For more info, and to add some support to my request, please have a look at this issue in the SAM CLI repo, where people have been ranting about this feature since 2017. 😅

Add support for multipart/form-data in RIE

I would love the ability to use multipart/form-data in local testing environments for my lambda functions. The official AWS API-Gateway supports this feature so I see no reason why this package shouldn't.

It could be enabled with a --flag on the startup call or something if need be.

`sam local start-api` broken due to missing `lambda-runtime-invoked-function-arn` header since v1.13.0

Description:

Up to version v1.12.0, I was able to test my API Gateway REST API using sam local start-api with a Lambda built on top of https://github.com/awslabs/aws-lambda-rust-runtime. However, this functionality stopped working in v1.13.0 due to the missing lambda-runtime-invoked-function-arn header that the runtime expects:

2020-12-04 17:54:54,881 | Found one Lambda function with name 'ApiFunction'
2020-12-04 17:54:54,881 | Invoking ignored (provided)
2020-12-04 17:54:54,881 | Environment variables overrides data is standard format
2020-12-04 17:54:54,881 | Loading AWS credentials from session with profile 'None'
2020-12-04 17:54:54,896 | Resolving code path. Cwd=/Users/daramos/...[redacted], CodeUri=.aws-sam/build-backend/ApiFunction
2020-12-04 17:54:54,897 | Resolved absolute path to code is /Users/daramos/...[redacted].../.aws-sam/build-backend/ApiFunction
2020-12-04 17:54:54,897 | Code /Users/daramos/...[redacted].../.aws-sam/build-backend/ApiFunction is not a zip/jar file
2020-12-04 17:54:54,940 | Skip pulling image and use local one: amazon/aws-sam-cli-emulation-image-provided:rapid-1.13.0.

2020-12-04 17:54:54,940 | Mounting /Users/daramos/Documents/Projects/...[redacted].../.aws-sam/build-backend/ApiFunction as /var/task:ro,delegated inside runtime container
2020-12-04 17:54:55,581 | Starting a timer for 3 seconds for function 'ApiFunction'
START RequestId: 5d85e30d-cda5-47dc-a1a6-4ed2ed87268c Version: $LATEST
thread 'main' panicked at 'no entry found for key "lambda-runtime-invoked-function-arn"', /Users/daramos/.cargo/git/checkouts/aws-lambda-rust-runtime-7c865cce90132439/13aa8f0/lambda/src/types.rs:131:35

The code runs fine on production AWS Lambda, so I believe this is a bug in the SAM CLI's local emulation, not in the Rust runtime. For reference, the runtime expects several headers to be provided by Lambda:
https://github.com/awslabs/aws-lambda-rust-runtime/blob/13aa8f01813e6949ca91aedafb286591fdf32217/lambda/src/types.rs#L123-L139

It looks like aws/aws-sam-cli#2425 may have introduced this regression (cc @sriram-mv). The code that previously set these headers was removed in that PR:
https://github.com/aws/aws-sam-cli/blob/559e4a564ba37906f2081c0de415b39bc9b2c3c1/samcli/local/rapid/init.go#L482-L486

Steps to reproduce:

Use sam local start-api to test a REST API locally. In my case, using AWS Labs's Rust runtime.

Observed result:

Lambda function panics due to missing headers (the same Lambda works fine on AWS).

Expected result:

Lambda should execute without error.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Mac OS 10.15.7
  2. sam --version: 1.13.0 (also tested on 1.13.2 and latest develop HEAD).

Add --debug flag to command you are running

Question: Is it possible to configure CORS?

Hi, y'all! First of all thanks for your great work. My first time using AWS Lambda tooling and I'm really enjoying the experience so far 😊

My question because I didn't really find anything in the docs (which makes sense as the product is rather new): is it possible to configure CORS for the local RIE docker container which holds my custom function? Once it is deployed I'd imagine you would configure this directly in AWS but until then I currently don't see a way how I'd tell it to set CORS headers.

It's not the biggest of problems, as I could just use another pass-through CORS proxy locally. I was just wondering whether this was already a supported scenario.

Thanks a lot in advance!

Support http-request with multipart/form-data.

When sending http-request using curl or postman with content-type as ‘application/json’, it is working well.
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{[body with json]}'
But with content-type as ‘multipart/form-data’, it is not working with error about “unmarshal input : ‘utf-8’”
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" --form '[some message or file]'

Error log
START RequestId: 869477bd-4c63-4d81-802c-416e9634067b Version: $LATEST Traceback (most recent call last):able to unmarshal input: 'utf-8' codec can't decode byte 0xb9 in position 451: invalid start byte END RequestId: 869477bd-4c63-4d81-802c-416e9634067b REPORT RequestId: 869477bd-4c63-4d81-802c-416e9634067b Duration: 20.28 ms Billed Duration: 100 ms Memory Size: 3008 MB Max Memory Used: 3008 MB

It need to support content-type as ‘multipart/form-data’. I wonder it is possible or only support ‘application/json’.

Feature request: Lambda Telemetry API support

Originally created by @hooverdc here. I wasn't able to move the issue so creating a new one and linking.

Describe your idea/feature/enhancement

I wish SAM CLI would support the Lambda Telemetry API

Proposal

Provide a mock endpoint similar to the Lambda Logs API in the Lambda runtime images.

SAM CLI would need support in RIE to make this achievable within the emulation images.

curl: (52) Empty reply from server

I recently ran into an issue trying to test a Lambda function locally with the provided base images. My handler is written in Go. Testing with both public.ecr.aws/lambda/go:1 and public.ecr.aws/lambda/provided:al2 gives the same error when attempting to curl the handler locally.

Here are the directions I was attempting to follow to test my function locally. https://gallery.ecr.aws/lambda/go (the Usage tab)

I ended up here after finding this workaround: #26. It's my understanding that these steps shouldn't be needed when working with one of the provided Docker images. If there is a better repository to file this issue please let me know. Thanks.

Add a --watch option for docker development

We are using public.ecr.aws/lambda/python:3.8which uses rie as an entrypoint.
We use docker as a local development environment, so we do not need to setup a python virtualenv and avoid "it works on my machine" errors. We map the source code into the container using a volume and at the moment the only way to get the container to the run the latest changes, is docker-compose restart CONTAINER-NAME.

This is not ideal and we would appreciate having a --watch flag added to rie such that we could add it to the docker-compose command option, e.g. ["app.handler", "--watch"]. This flag would rerun the server inside the container upon changes, similar to Flask's runserver.

Hardcoded function name

I'm not sure if this is a bug or a feature (request). I'll let someone else decide which it is.

The Lambda invoke API docs say the endpoint path should be /2015-03-31/functions/FunctionName/invocations where FunctionName is the name of the function being invoked.

The RIE web server hardcods the function name to function. When invoking a function by calling the documented curl call curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}' everything works great.

If someone combines a container based Lambda using the RIE and the Step Function Local and the step function contains a different function name, say myFunction they could easily lose an afternoon debugging their stuff. Step Function Local logs an exception based on the 404 response, but the RIE logs show no requests being received. After checking the Step Function Local config docs, reviewing the step function multiple times, reviewing the Lambda API docs and busting out wireshark the dev may pick through the RIE code. Eventually they would discover the cause of this bug. Less than a minute after changing the value of the Lambda ARN in their step function, everything works.

Rather than forcing devs to use a fixed name in their step function, I propose that if the AWS_LAMBDA_FUNCTION_NAME environment variable is set, then that is the value used in the endpoint path. If the environment variable isn't present then function is used as the default value. This might save some poor developers many hours of swearing at their code.

Test lambda that has websocket routes

Not sure if it's possible with this approach, but suppose the lambda is the back-end for an API Gateway that uses websockets. How could this be tested using this interface emulator?

I haven't been able to find details on how an event to invoke a lambda function looks like when using web sockets.

I know for a REST Api this is a valid event

{
  "resource": "/{proxy+}",
  "path": "/api/values",
  "httpMethod": "GET",
  "headers": null,
  "queryStringParameters": null,
  "pathParameters": {
    "proxy": "api/values"
  },
  "stageVariables": null,
  "requestContext": {
    "accountId": "AAAAAAAAAAAA",
    "resourceId": "5agfss",
    "stage": "test-invoke-stage",
    "requestId": "test-invoke-request",
    "identity": {
      "cognitoIdentityPoolId": null,
      "accountId": "AAAAAAAAAAAA",
      "cognitoIdentityId": null,
      "caller": "BBBBBBBBBBBB",
      "apiKey": "test-invoke-api-key",
      "sourceIp": "test-invoke-source-ip",
      "cognitoAuthenticationType": null,
      "cognitoAuthenticationProvider": null,
      "userArn": "arn:aws:iam::AAAAAAAAAAAA:root",
      "userAgent": "Apache-HttpClient/4.5.x (Java/1.8.0_102)",
      "user": "AAAAAAAAAAAA"
    },
    "resourcePath": "/{proxy+}",
    "httpMethod": "GET",
    "apiId": "t2yh6sjnmk"
  },
  "body": null
}

and therefore, if I save it in a test_request.json I could test the lambda function like this with CURL when running in the emulator

curl -vX POST http://localhost:9000/2015-03-31/functions/function/invocations -d @test_request.json --header "Content-Type: application/json"

Is there anything similar when the event represents a $connect, $disconnect or sendmessage message from Api Gateway websocket to lambda?

/usr/local/bin/aws-lambda-rie: Permission denied

Been trying to locally test (from my macbook) a docker container for aws lambda, but I'm getting permission errors. I set the bash file to executable for ENTRYPOINT [ "./entry_script.sh" ], not sure what's going on.

Go Panic When Calling the `/runtime/init/error` Endpoint

time="2021-04-28T14:07:35.625" level=panic msg="ReplyStream not available"
2021/04/28 14:07:35 http: panic serving 127.0.0.1:52492: &{0xc000164000 map[] 2021-04-28 14:07:35.62583 +0000 UTC m=+2.137851001 panic <nil> ReplyStream not available <nil> <nil> }
goroutine 21 [running]:
net/http.(*conn).serve.func1(0xc000130aa0)
	/usr/local/go/src/net/http/server.go:1800 +0x139
panic(0x866640, 0xc0001641c0)
	/usr/local/go/src/runtime/panic.go:975 +0x3e3
github.com/sirupsen/logrus.Entry.log(0xc000164000, 0xc000106f00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/pkg/mod/github.com/sirupsen/[email protected]/entry.go:259 +0x335
github.com/sirupsen/logrus.(*Entry).Log(0xc0001640e0, 0xc000000000, 0xc00008d588, 0x1, 0x1)
	/go/pkg/mod/github.com/sirupsen/[email protected]/entry.go:287 +0xeb
github.com/sirupsen/logrus.(*Logger).Log(0xc000164000, 0xc000000000, 0xc00008d588, 0x1, 0x1)
	/go/pkg/mod/github.com/sirupsen/[email protected]/logger.go:193 +0x7d
github.com/sirupsen/logrus.(*Logger).Panic(...)
	/go/pkg/mod/github.com/sirupsen/[email protected]/logger.go:234
github.com/sirupsen/logrus.Panic(...)
	/go/pkg/mod/github.com/sirupsen/[email protected]/exported.go:129
go.amzn.com/lambda/rapi/rendering.RenderInteropError(0x9097c0, 0xc00018c0e0, 0xc0001a8200, 0x902b60, 0xc0001050c0)
	/LambdaRuntimeLocal/lambda/rapi/rendering/rendering.go:292 +0x9a
go.amzn.com/lambda/rapi/handler.(*initErrorHandler).ServeHTTP(0xc0002140a0, 0x9097c0, 0xc00018c0e0, 0xc0001a8200)
	/LambdaRuntimeLocal/lambda/rapi/handler/initerror.go:52 +0x519
net/http.HandlerFunc.ServeHTTP(0xc000202380, 0x9097c0, 0xc00018c0e0, 0xc0001a8200)
	/usr/local/go/src/net/http/server.go:2041 +0x44
github.com/go-chi/chi.(*Mux).routeHTTP(0xc00021e0c0, 0x9097c0, 0xc00018c0e0, 0xc0001a8200)
	/go/pkg/mod/github.com/go-chi/[email protected]+incompatible/mux.go:431 +0x278
net/http.HandlerFunc.ServeHTTP(0xc000214030, 0x9097c0, 0xc00018c0e0, 0xc0001a8200)
	/usr/local/go/src/net/http/server.go:2041 +0x44
go.amzn.com/lambda/rapi/middleware.RuntimeReleaseMiddleware.func1.1(0x9097c0, 0xc00018c0e0, 0xc0001a8200)
	/LambdaRuntimeLocal/lambda/rapi/middleware/middleware.go:100 +0xea
net/http.HandlerFunc.ServeHTTP(0xc000202180, 0x9097c0, 0xc00018c0e0, 0xc0001a8200)
	/usr/local/go/src/net/http/server.go:2041 +0x44
go.amzn.com/lambda/rapi/middleware.AccessLogMiddleware.func1.1(0x9097c0, 0xc00018c0e0, 0xc0001a8200)
	/LambdaRuntimeLocal/lambda/rapi/middleware/middleware.go:77 +0x170
net/http.HandlerFunc.ServeHTTP(0xc0002021a0, 0x9097c0, 0xc00018c0e0, 0xc0001a8200)
	/usr/local/go/src/net/http/server.go:2041 +0x44
go.amzn.com/lambda/rapi/middleware.AppCtxMiddleware.func1.1(0x9097c0, 0xc00018c0e0, 0xc0001a8100)
	/LambdaRuntimeLocal/lambda/rapi/middleware/middleware.go:66 +0x77
net/http.HandlerFunc.ServeHTTP(0xc0002122d0, 0x9097c0, 0xc00018c0e0, 0xc0001a8100)
	/usr/local/go/src/net/http/server.go:2041 +0x44
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc00021e0c0, 0x9097c0, 0xc00018c0e0, 0xc0001a8100)
	/go/pkg/mod/github.com/go-chi/[email protected]+incompatible/mux.go:70 +0x513
github.com/go-chi/chi.(*Mux).Mount.func1(0x9097c0, 0xc00018c0e0, 0xc0001a8100)
	/go/pkg/mod/github.com/go-chi/[email protected]+incompatible/mux.go:298 +0x118
net/http.HandlerFunc.ServeHTTP(0xc0002023e0, 0x9097c0, 0xc00018c0e0, 0xc0001a8100)
	/usr/local/go/src/net/http/server.go:2041 +0x44
github.com/go-chi/chi.(*Mux).routeHTTP(0xc00021e060, 0x9097c0, 0xc00018c0e0, 0xc0001a8100)
	/go/pkg/mod/github.com/go-chi/[email protected]+incompatible/mux.go:431 +0x278
net/http.HandlerFunc.ServeHTTP(0xc0002140c0, 0x9097c0, 0xc00018c0e0, 0xc0001a8100)
	/usr/local/go/src/net/http/server.go:2041 +0x44
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc00021e060, 0x9097c0, 0xc00018c0e0, 0xc0001a8000)
	/go/pkg/mod/github.com/go-chi/[email protected]+incompatible/mux.go:86 +0x2b2
net/http.serverHandler.ServeHTTP(0xc000222000, 0x9097c0, 0xc00018c0e0, 0xc0001a8000)
	/usr/local/go/src/net/http/server.go:2836 +0xa3
net/http.(*conn).serve(0xc000130aa0, 0x90a800, 0xc00012e480)
	/usr/local/go/src/net/http/server.go:1924 +0x86c
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2962 +0x35c

Here's a minimal example that reproduces this: https://github.com/chrisguitarguy/rie-init-error-example (./run_example there should do it).

Seems to originate from here:

return fmt.Errorf("ReplyStream not available")

There are some additional warnings that show up too:

time="2021-04-28T14:07:35.64" level=warning msg="Failed to send default error response: ErrInvalidInvokeID"
time="2021-04-28T14:07:35.64" level=error msg="INIT DONE failed: Runtime.ExitError"
time="2021-04-28T14:07:35.641" level=warning msg="Reset initiated: ReserveFail"

Looking at that server.go, it seems like it all depends on invokeCtx being set, but that wouldn't be set up for init errors given there is not invoke context yet -- something went wrong before it go to that point, right?

Environment variable for runtime-interface-emulator-address

Please allow setting the runtime-interface-emulator-address via an environment variable.
At the moment it's only possible to configure it through the command line.

Use case:
Trying to run a lambda locally (e.g. public.ecr.aws/lambda/ruby:3.2-x86_64) which needs to connect to a port on the host using the --network host parameter.
At the moment I need to manually patch the lambda-entrypoint.sh file, e.g. change the line to configure the port
From:

exec /usr/local/bin/aws-lambda-rie $RUNTIME_ENTRYPOINT

To:

exec /usr/local/bin/aws-lambda-rie $RUNTIME_ENTRYPOINT --runtime-interface-emulator-address=0.0.0.0:9999

Order of `--entrypoint` in example appears incorrect

After much frustration, I just discovered that the following command in the readme does not quite work: docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 myfunction:latest --entrypoint /aws-lambda/aws-lambda-rie <image entrypoint> <(optional) image command>

On Docker version 20.10.5, build 55c4c88 for Mac (apple silicon), docker run appears to completely ignore the --entrypoint argument unless it is written before the image name.

Here is what ended up working for me:

docker run \
	--detach \
	--volume ~/.aws-lambda-rie:/aws-lambda \
	--publish 9000:8080 \
	--entrypoint /aws-lambda/aws-lambda-rie \
	myfunction:latest \
	/usr/local/bin/python3 -m awslambdaric func.handler

Where func.handler refers to a file func.py that contains:

def handler(event, context):
  return "My handler result."

If you agree, please update the readme. Thanks!

env var to set loglevel for python logging

Is there a way to set the loglevel through an env var?
This would be especially useful for lambda-docker.
We would like to be able to filter out a lot of noise and only see our app logs, at least during development.

Getting a 502 Bad Gateway response during the local testing of the container based lambda

I am following the example here https://pypi.org/project/awslambdaric/ . When I run the curl command to test the lambda I get no response. With the increased verbosity in the curl command I get the error 502 Bad gateway. The peculiar thing is that sending curl command again hangs - with the last message being "upload completely sent off: 2 out of 2 bytes". A standard docker nginx test works fine (something similar to https://www.docker.com/blog/how-to-use-the-official-nginx-docker-image/)

arm64 and xnu blockers?

"The component supports only Linux x84-64 architectures"

What is the blocker to running on macos_arm64? Quick glance I didn't see any x86 specific dependencies or Linux specific threading. Is there something I missed?

curl: (52) Empty reply from server

Env

MacOS: 10.15.7
Docker on Mac: Version 18.06.1-ce-mac73 (26764).
Docker Engin: Engine: 18.06.1-ce

Premise

Dockerfile

FROM public.ecr.aws/lambda/provided:al2
COPY bin/search_tutor /search_tutor
ENTRYPOINT [ "/search_tutor" ]

search_tutor is just a binary file built by Golang.

The app Lambda is for API Gateway integration and has the same structure with https://docs.aws.amazon.com/lambda/latest/dg/golang-handler.html

docker build -t myfunction:latest .
docker run -p 9000:8080 --env-file ./env.list myfunction:latest
$ docker ps
94685e614c95        myfunction:latest                                     "/search_tutor"          8 minutes ago       Up 8 minutes        0.0.0.0:9000->8080/tcp             myfunction

I confirmed Go app initialization is finished. Also, it seems Go app is listening for requests.

Problem

When I call the docker from my local of RIE like below.

curl -XPOST "http://localhost:9000/215-03-31/functns/function/invocations" -d '{}'

I'm getting the following error.

curl: (52) Empty reply from server

I understand it's network issue between host and the docker container but I don't know the root cause and how to debug.

Lambda RIE as Standalone App/Container for Testing

Hello,

For Testing purposes, in this case Java, it would be great that AWS makes Lambda RIE available as Standalone App/Container so we can easily add this to JUnit 5 + Test Containers and be able to do Integration Tests (via Public ECR Gallery) on our Clients.

Thanks

Missing response header X-Amz-Function-Error

I wasn't sure whether to open this here or over in https://github.com/aws/aws-lambda-nodejs-runtime-interface-client

With a simple example that always throws an error:

FROM public.ecr.aws/lambda/nodejs:12
RUN echo 'module.exports = { handler: () => { throw new Error("failure"); } }' > index.js
CMD ["index.handler"]

When I hit the endpoint:

$ curl -qv http://localhost:8080/2015-03-31/functions/function/invocations -d '{}'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> POST /2015-03-31/functions/function/invocations HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Length: 2
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 2 out of 2 bytes
< HTTP/1.1 200 OK
< Date: Mon, 18 Jan 2021 23:27:37 GMT
< Content-Length: 184
< Content-Type: text/plain; charset=utf-8
< 
* Connection #0 to host localhost left intact
{"errorType":"Error","errorMessage":"failure","trace":["Error: failure","    at Runtime.handler (/var/task/index.js:1:43)","    at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"]}* Closing connection 0
$

As expected, the response payload has the shape described in https://docs.aws.amazon.com/lambda/latest/dg/nodejs-exceptions.html and the status is 200 to denote a function error.

However, shouldn't the response headers include X-Amz-Function-Error so that the error status can be determined without relying on heuristics?

Also, Content-Type should be application/json.

image entrypoint documentation

I'm trying to run a local container that has been created as a lambda dotnet 5 image following an Amazon template.
In other words, I have a dotnet 5 project with a AWS lambda function which I have created with

dotnet new -i Amazon.Lambda.Templates
dotnet new serverless.image.AspNetCoreWebAPI -n LambdaDotNet5
dotnet build -c Release
dotnet publish -c Release

This creates a dotnet project with a simple Dockerfile (notice there is no entry point or anything) and compiles it and publishes its artifacts in a folder.

FROM public.ecr.aws/lambda/dotnet:5.0
WORKDIR /var/task
COPY "bin/Release/net5.0/publish"  .

Notice by default this line was COPY "bin/Release/net5.0/linux-x64/publish" . but my dotnet publish -c Release places it under publish folder, without the linux-x64 part.
Now I follow the instructions described and I can build a docker image locally

docker build -t lambda-dotnet .

Using a git-bash linux-like terminal in Windows I run

mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && chmod +x ~/.aws-lambda-rie/aws-lambda-rie

and I can see the emulator properly downloaded

ls -la ~/.aws-lambda-rie/aws-lambda-rie
-rw-r--r-- 1 diego.martin 1049089 8155136 Feb 22 13:32 /c/Users/diego.martin/.aws-lambda-rie/aws-lambda-rie

Now I want to run the emulator with my container, so here's where I'm not sure what am I doing or what may be the problem

docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 --entrypoint /aws-lambda/aws-lambda-rie lambda-dotnet:latest

Notice I don't specify any entrypoint because I don't have any in my image. So the output is

54b355026ba16fc12d5884b38ff4f9cb481e007ac1cdbc222f17666891c9aa94
docker: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "C:/Users/diego.martin/AppData/Local/Programs/Git/aws-lambda/aws-lambda-rie": stat C:/Users/diego.martin/AppData/Local/Programs/Git/aws-lambda/aws-lambda-rie: no such file or directory: unknown.

What am I missing and what would be the command to run the RIE with my lambda container?

Debugging Dotnet Lambda Question

I'm able to attach VSCode to the container on the rie process but I'm not able to hit my breakpoints. Is there a way to get this to work?

Local environment with RIE and funcion names

Hi,

I have been using your interface extensively to build a suite of Lambda apps. Our architecture encompasses several Lambda functions, that are supposed to talk to each other via the boto3 Python client. Thus far, I'm handling everything with HTTP ports on localhost, having a slightly different code base from the actual one that will be hosted on AWS.

Is it possible to have named Lambda functions within RIE, in order to use invoke calls via the boto3 Python client?

Runtime error: invalid memory address or nil pointer dereference

The following error occurs when executing several simultaneous requests:


19 Jun 2023 22:05:39,909 [INFO] (rapid) ReserveFailed: AlreadyReserved
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x68c30f]

goroutine 131 [running]:
go.amzn.com/lambda/rapidcore.(*Server).Invoke.func2()
/LambdaRuntimeLocal/lambda/rapidcore/server.go:653 +0xef
created by go.amzn.com/lambda/rapidcore.(*Server).Invoke
/LambdaRuntimeLocal/lambda/rapidcore/server.go:636 +0x23d


Docker image: public.ecr.aws/lambda/python:3.8

Documentation: Explain `<image entrypoint>`

In the instructions there are some small pieces left out that make documentation difficult to understand.
This is one piece. What is the image entrypoint? I think it is wise not to assume people reading know what that is.

What are the minimum required ingredients to get this tool working?
What script names do I need to create in order to follow along with the instructions?

Emulate API Gateway payload in event object

We run our lambdas behind an API Gateway. The event object in the lambda when we run locally does not have the same structure as the event object when running behind an API Gateway.

For example, if I want to post to a path with the /{model} parameter, I need to post with this wrapping my payload

{
    "pathParameters": {
        "model": model
    },
    "body": { .. json payload ...}
}

When I call my API Gateway endpoint I do not need to wrap the payload, as this is created by API Gateway as it passes the payload off to the lambda.

What I would really like is to be able to set an ENV var such as LAMBDA_MODE which when set to API_GATEWAY RIE wraps the event to mimic the event passed by the API Gateway. It would need to work the same for response objects too. If not set, then it would work in the default mode which is how it works today.

A port for debugging and stepping into the code

When running the service locally it would be helpful if we can step into the code. I believe this is possible when using SAM but not when we using container images and running the function using RIE.

for example when running usual java apps we can add -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 to the run command then listen to 5005 to be able to step into the code.

Maybe a possible way would be to add a --debug-port option to the /usr/bin/aws-lambda-rie command

How to use --runtime-api-address?

Hi folks! We'd like to use a different port than the default 8080, and it appears there's a flag for setting it. What's the right syntax?

The following does not work:

/app/aws-lambda-rie --runtime-api-address=0.0.0.0:8080 /usr/local/bin/python -m awslambdaric my_file.handler

go install is broken

motivation: go install is the standard default way of installing go programs, but for this package is broken.

go install github.com/aws/aws-lambda-runtime-interface-emulator/cmd/aws-lambda-rie@latest

produces this error:

go install github.com/aws/aws-lambda-runtime-interface-emulator/cmd/aws-lambda-rie@latest
go: github.com/aws/aws-lambda-runtime-interface-emulator/cmd/aws-lambda-rie@latest: version constraints conflict:
	github.com/aws/aws-lambda-runtime-interface-emulator@v0.0.0-20230608002416-bf7e24860347: parsing go.mod:
	module declares its path as: go.amzn.com
	        but was required as: github.com/aws/aws-lambda-runtime-interface-emulator

any chance that this package gets renamed to github.com/aws/aws-lambda-runtime-interface-emulator instead of go.amzn.com

Integration test suite is broken

The tests aren't running properly because of duplicated container names. Further subsequent invocations create further failures because the tear down step is missing some of the containers.

Despite these failures being noted in the console, the test suite only catches one of the failures on the first run. On the second run there are more errors, but the suite passes.

First Invocation

$ make integ-tests-with-docker
go test ./...
?   	go.amzn.com/cmd/aws-lambda-rie	[no test files]
ok  	go.amzn.com/lambda/agents	(cached)
ok  	go.amzn.com/lambda/appctx	(cached)
ok  	go.amzn.com/lambda/core	(cached)
ok  	go.amzn.com/lambda/core/directinvoke	(cached)
?   	go.amzn.com/lambda/core/statejson	[no test files]
?   	go.amzn.com/lambda/extensions	[no test files]
?   	go.amzn.com/lambda/fatalerror	[no test files]
?   	go.amzn.com/lambda/interop	[no test files]
ok  	go.amzn.com/lambda/logging	(cached)
ok  	go.amzn.com/lambda/metering	(cached)
ok  	go.amzn.com/lambda/rapi	(cached)
ok  	go.amzn.com/lambda/rapi/handler	(cached)
ok  	go.amzn.com/lambda/rapi/middleware	(cached)
ok  	go.amzn.com/lambda/rapi/model	(cached)
?   	go.amzn.com/lambda/rapi/rendering	[no test files]
ok  	go.amzn.com/lambda/rapid	(cached)
ok  	go.amzn.com/lambda/rapidcore	(cached)
ok  	go.amzn.com/lambda/rapidcore/env	(cached)
?   	go.amzn.com/lambda/rapidcore/standalone	[no test files]
?   	go.amzn.com/lambda/rapidcore/telemetry	[no test files]
?   	go.amzn.com/lambda/rapidcore/telemetry/logsapi	[no test files]
ok  	go.amzn.com/lambda/runtimecmd	(cached)
ok  	go.amzn.com/lambda/telemetry	(cached)
docker run --env GOPROXY=direct -v /path/to/aws-lambda-runtime-interface-emulator:/LambdaRuntimeLocal -w /LambdaRuntimeLocal golang:1.14 make compile-lambda-linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o bin/aws-lambda-rie ./cmd/aws-lambda-rie
go: downloading github.com/google/uuid v1.1.2
go: downloading github.com/sirupsen/logrus v1.6.0
go: downloading github.com/jessevdk/go-flags v1.4.0
go: downloading github.com/go-chi/chi v4.1.2+incompatible
go: downloading github.com/go-chi/render v1.0.1
go: downloading golang.org/x/sys v0.0.0-20190422165155-953cdadca894
python3 -m venv .venv
.venv/bin/pip install --upgrade pip
Requirement already satisfied: pip in ./.venv/lib/python3.9/site-packages (21.1.3)
Collecting pip
  Using cached pip-21.2.4-py3-none-any.whl (1.6 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.1.3
    Uninstalling pip-21.1.3:
      Successfully uninstalled pip-21.1.3
Successfully installed pip-21.2.4
.venv/bin/pip install requests
Collecting requests
  Using cached requests-2.26.0-py2.py3-none-any.whl (62 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.6-py2.py3-none-any.whl (138 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.2-py3-none-any.whl (59 kB)
Collecting charset-normalizer~=2.0.0
  Using cached charset_normalizer-2.0.4-py3-none-any.whl (36 kB)
Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests
Successfully installed certifi-2021.5.30 charset-normalizer-2.0.4 idna-3.2 requests-2.26.0 urllib3-1.26.6
.venv/bin/python3 test/integration/local_lambda/end-to-end-test.py
[+] Building 11.1s (8/8) FINISHED
 => [internal] load build definition from Dockerfile-allinone                                                                                                                                                                       0.0s
 => => transferring dockerfile: 217B                                                                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                                                                     0.0s
 => [internal] load metadata for public.ecr.aws/lambda/python:3.8                                                                                                                                                                  11.0s
 => [1/3] FROM public.ecr.aws/lambda/python:3.8@sha256:af98ec7625cc27f3efb189a753f57be48d4bedf4f558770157f3651e8bcb56a6                                                                                                             0.0s
 => [internal] load build context                                                                                                                                                                                                   0.0s
 => => transferring context: 1.71kB                                                                                                                                                                                                 0.0s
 => CACHED [2/3] WORKDIR /var/task                                                                                                                                                                                                  0.0s
 => CACHED [3/3] COPY ./ ./                                                                                                                                                                                                         0.0s
 => exporting to image                                                                                                                                                                                                              0.0s
 => => exporting layers                                                                                                                                                                                                             0.0s
 => => writing image sha256:e26aedd62dcec294fd7314bed8482bb9073623c1c2ff2a005eb6ac1bb6740d36                                                                                                                                        0.0s
 => => naming to docker.io/library/aws-lambda-local:testing                                                                                                                                                                         0.0s
0a1ac6973c0b3af7da123e9b4b83c15a94030dd64b51a224ad38a416bd082443
Ee33c68dd37c9e05bf78dc5a9ac4c717dd4dff152d8253c906c7ad39679796654
.635983bf9fe8d2eaef56cb90ed5a1716992fd883da68d62bacffc42e81f534ca
.707bea10bf31192a7b0e7a98fa07fa983607207a5c47461c11a5c66575b10b85
.61c45528518d5d528b8b49bc548de994c212504850f44ffb920f112ce33d4b19
.d8c0d8aed403fbe34af3199903fcd365a0583a4d84cf7f30e254ca13cedf9b97
.docker: Error response from daemon: Conflict. The container name "/testing" is already in use by container "d8c0d8aed403fbe34af3199903fcd365a0583a4d84cf7f30e254ca13cedf9b97". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
.b3fc2c0bdd914fc3d29efbc3992c2a213fb5cc08be97d5c5804144b45c4d5fb5
.docker: Error response from daemon: Conflict. The container name "/testing" is already in use by container "d8c0d8aed403fbe34af3199903fcd365a0583a4d84cf7f30e254ca13cedf9b97". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
.envvarcheck
testing
timeout
exception
Error response from daemon: conflict: unable to remove repository reference "aws-lambda-local:testing" (must force) - container 635983bf9fe8 is using its referenced image e26aedd62dce
[+] Building 0.4s (8/8) FINISHED
 => [internal] load build definition from Dockerfile-python36                                                                                                                                                                       0.0s
 => => transferring dockerfile: 217B                                                                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                                                                     0.0s
 => [internal] load metadata for public.ecr.aws/lambda/python:3.8                                                                                                                                                                   0.3s
 => [internal] load build context                                                                                                                                                                                                   0.0s
 => => transferring context: 107B                                                                                                                                                                                                   0.0s
 => [1/3] FROM public.ecr.aws/lambda/python:3.8@sha256:af98ec7625cc27f3efb189a753f57be48d4bedf4f558770157f3651e8bcb56a6                                                                                                             0.0s
 => CACHED [2/3] WORKDIR /var/task                                                                                                                                                                                                  0.0s
 => CACHED [3/3] COPY ./ ./                                                                                                                                                                                                         0.0s
 => exporting to image                                                                                                                                                                                                              0.0s
 => => exporting layers                                                                                                                                                                                                             0.0s
 => => writing image sha256:e26aedd62dcec294fd7314bed8482bb9073623c1c2ff2a005eb6ac1bb6740d36                                                                                                                                        0.0s
 => => naming to docker.io/library/aws-lambda-local:testing-py36                                                                                                                                                                    0.0s
cb043dfe61f2b6f6292495ec60baf90faeebe0bd55d0c0e7398dd3ceb79dfbfb
.b59248a9811888eec24fa94bf6990cbccddc2d0176337f65b5f591c022e0992a
.testing
assert-overwritten
Untagged: aws-lambda-local:testing-py36

======================================================================
ERROR: test_context_get_remaining_time_in_default_deadline (__main__.TestEndToEnd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1349, in getresponse
    response.begin()
  File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 316, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 285, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1349, in getresponse
    response.begin()
  File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 316, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 285, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/path/to/aws-lambda-runtime-interface-emulator/test/integration/local_lambda/end-to-end-test.py", line 142, in test_context_get_remaining_time_in_default_deadline
    r = requests.post("http://localhost:9006/2015-03-31/functions/function/invocations", json={})
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/requests/api.py", line 117, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/path/to/aws-lambda-runtime-interface-emulator/.venv/lib/python3.9/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

----------------------------------------------------------------------
Ran 11 tests in 43.669s

FAILED (errors=1)
make: *** [integ-tests-with-docker] Error 1

Second Invocation

$ make integ-tests
python3 -m venv .venv
.venv/bin/pip install --upgrade pip
Requirement already satisfied: pip in ./.venv/lib/python3.9/site-packages (21.2.4)
.venv/bin/pip install requests
Requirement already satisfied: requests in ./.venv/lib/python3.9/site-packages (2.26.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./.venv/lib/python3.9/site-packages (from requests) (1.26.6)
Requirement already satisfied: charset-normalizer~=2.0.0 in ./.venv/lib/python3.9/site-packages (from requests) (2.0.4)
Requirement already satisfied: certifi>=2017.4.17 in ./.venv/lib/python3.9/site-packages (from requests) (2021.5.30)
Requirement already satisfied: idna<4,>=2.5 in ./.venv/lib/python3.9/site-packages (from requests) (3.2)
.venv/bin/python3 test/integration/local_lambda/end-to-end-test.py
[+] Building 1.1s (8/8) FINISHED
 => [internal] load build definition from Dockerfile-allinone                                                                                                                                                                       0.0s
 => => transferring dockerfile: 217B                                                                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                                                                     0.0s
 => [internal] load metadata for public.ecr.aws/lambda/python:3.8                                                                                                                                                                   1.0s
 => [1/3] FROM public.ecr.aws/lambda/python:3.8@sha256:af98ec7625cc27f3efb189a753f57be48d4bedf4f558770157f3651e8bcb56a6                                                                                                             0.0s
 => [internal] load build context                                                                                                                                                                                                   0.0s
 => => transferring context: 107B                                                                                                                                                                                                   0.0s
 => CACHED [2/3] WORKDIR /var/task                                                                                                                                                                                                  0.0s
 => CACHED [3/3] COPY ./ ./                                                                                                                                                                                                         0.0s
 => exporting to image                                                                                                                                                                                                              0.0s
 => => exporting layers                                                                                                                                                                                                             0.0s
 => => writing image sha256:e26aedd62dcec294fd7314bed8482bb9073623c1c2ff2a005eb6ac1bb6740d36                                                                                                                                        0.0s
 => => naming to docker.io/library/aws-lambda-local:testing                                                                                                                                                                         0.0s
docker: Error response from daemon: Conflict. The container name "/remainingtimedefault" is already in use by container "0a1ac6973c0b3af7da123e9b4b83c15a94030dd64b51a224ad38a416bd082443". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
.docker: Error response from daemon: Conflict. The container name "/remainingtimeten" is already in use by container "e33c68dd37c9e05bf78dc5a9ac4c717dd4dff152d8253c906c7ad39679796654". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
.docker: Error response from daemon: Conflict. The container name "/remainingtimethree" is already in use by container "635983bf9fe8d2eaef56cb90ed5a1716992fd883da68d62bacffc42e81f534ca". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
.6e0a5ba623f331fcd11891836d395c7a899813b45031e3079470c9d8b17236b4
.43040af058d655d5a5953e6c55dedf69f83b2f09ec7e45243757371c377a6779
.b640cd2ee547ab8745cefb0abaad543c58cfd7ee750220207234c08858f5b0ea
.docker: Error response from daemon: Conflict. The container name "/testing" is already in use by container "b640cd2ee547ab8745cefb0abaad543c58cfd7ee750220207234c08858f5b0ea". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
.fc8077999ffa686ccec9a5f940d1c0ccdb44bab8eb0f43da0db7d030fc3b976e
.docker: Error response from daemon: Conflict. The container name "/testing" is already in use by container "b640cd2ee547ab8745cefb0abaad543c58cfd7ee750220207234c08858f5b0ea". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
.envvarcheck
testing
timeout
exception
Error response from daemon: conflict: unable to remove repository reference "aws-lambda-local:testing" (must force) - container 635983bf9fe8 is using its referenced image e26aedd62dce
[+] Building 0.4s (8/8) FINISHED
 => [internal] load build definition from Dockerfile-python36                                                                                                                                                                       0.0s
 => => transferring dockerfile: 217B                                                                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                                                                     0.0s
 => [internal] load metadata for public.ecr.aws/lambda/python:3.8                                                                                                                                                                   0.3s
 => [1/3] FROM public.ecr.aws/lambda/python:3.8@sha256:af98ec7625cc27f3efb189a753f57be48d4bedf4f558770157f3651e8bcb56a6                                                                                                             0.0s
 => [internal] load build context                                                                                                                                                                                                   0.0s
 => => transferring context: 107B                                                                                                                                                                                                   0.0s
 => CACHED [2/3] WORKDIR /var/task                                                                                                                                                                                                  0.0s
 => CACHED [3/3] COPY ./ ./                                                                                                                                                                                                         0.0s
 => exporting to image                                                                                                                                                                                                              0.0s
 => => exporting layers                                                                                                                                                                                                             0.0s
 => => writing image sha256:e26aedd62dcec294fd7314bed8482bb9073623c1c2ff2a005eb6ac1bb6740d36                                                                                                                                        0.0s
 => => naming to docker.io/library/aws-lambda-local:testing-py36                                                                                                                                                                    0.0s
45bb379b15c6edec3bfc81336e389c1e5224c5ee221219fcdd6706068c6168dc
.1bf6581903f9aa1a0852c73f5f6788fa5856de21034136fe701cc8ff7521ae3f
.testing
assert-overwritten
Untagged: aws-lambda-local:testing-py36

----------------------------------------------------------------------
Ran 11 tests in 35.430s

OK

go packges verion issue

Hi Team,

for the go version - 1.19.11 there is Vulnerability present at the prisma cloud scan with fixed versions 1.20.7, 1.19.12

Risk factor - Attack complexity: low, Attack vector: network, DoS - High, has fix, High severity, Recent vulnerability.

https://nvd.nist.gov/vuln/detail/CVE-2023-39533

description of vulnerability - go-libp2p is the Go implementation of the libp2p Networking Stack. Prior to versions 0.27.8, 0.28.2, and 0.29.1 malicious peer can use large RSA keys to run a resource exhaustion attack & force a node to spend time doing signature verification of the large key. This vulnerability is present in the core/crypto module of go-libp2p and can occur during the Noise handshake and the libp2p x509 extension verification step. To prevent this attack, go-libp2p versions 0.27.8, 0.28.2, and 0.29.1 restrict RSA keys to <= 8192 bits. To protect one's application, it is necessary to update to these patch releases and to use the updated Go compiler in 1.20.7 or 1.19.12. There are no known workarounds for this issue.

Runtime exited with error with customized Lambda image

Hi folks

I been exploring our container support in Lambda, for both official container image (public.ecr.aws/lambda/python:3.7) and customized image with RIC/RIE (python:buster). The official image works fine, however customized image failed with error for local invoke curl -X POST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"payload":"hello world!"}', or Lambda console invoke. Not sure it's dockerfile compose, RIC/RIE or other issue, anyone had been met the same issue?

local env:

$ docker run -p 9000:8080 local-lambda-python3.8-custom-ocr:latest
time="2020-12-28T04:18:10.654" level=info msg="exec '/usr/local/bin/python' (cwd=/opt, handler=app.handler)"START RequestId: ad5c6337-7132-4619-8165-b7456ea4ae01 Version: $LATEST
time="2020-12-28T04:18:13.918" level=info msg="extensionsDisabledByLayer(/opt/disable-extensions-jwigqn8j) -> stat /opt/disable-extensions-jwigqn8j: no such file or directory"
time="2020-12-28T04:18:13.918" level=warning msg="Cannot list external agents" error="open /opt/extensions: no such file or directory"
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/awslambdaric/__main__.py", line 21, in <module>
    main(sys.argv)
  File "/opt/awslambdaric/__main__.py", line 17, in main
    bootstrap.run(app_root, handler, lambda_runtime_api_addr)
  File "/opt/awslambdaric/bootstrap.py", line 416, in run
    event_request = lambda_runtime_client.wait_next_invocation()
  File "/opt/awslambdaric/lambda_runtime_client.py", line 76, in wait_next_invocation
    response_body, headers = runtime_client.next()
AttributeError: 'NoneType' object has no attribute 'next'
Executing 'app.handler' in function directory '/opt'
time="2020-12-28T04:18:14.276" level=warning msg="First fatal error stored in appctx: Runtime.ExitError"
time="2020-12-28T04:18:14.276" level=warning msg="Process 16(python) exited: Runtime exited with error: exit status 1"
time="2020-12-28T04:18:14.276" level=error msg="Init failed" InvokeID= error="Runtime exited with error: exit status 1"
time="2020-12-28T04:18:14.276" level=warning msg="Failed to send default error response: ErrInvalidInvokeID"
time="2020-12-28T04:18:14.277" level=error msg="INIT DONE failed: Runtime.ExitError"
time="2020-12-28T04:18:14.277" level=warning msg="Reset initiated: ReserveFail"

Lambda console:

START RequestId: 0737419e-378e-4989-8d59-e54092369fed Version: $LATEST
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/opt/awslambdaric/__main__.py", line 21, in <module>
    main(sys.argv)
  File "/opt/awslambdaric/__main__.py", line 17, in main
    bootstrap.run(app_root, handler, lambda_runtime_api_addr)
  File "/opt/awslambdaric/bootstrap.py", line 416, in run
    event_request = lambda_runtime_client.wait_next_invocation()
  File "/opt/awslambdaric/lambda_runtime_client.py", line 76, in wait_next_invocation
    response_body, headers = runtime_client.next()
AttributeError: 'NoneType' object has no attribute 'next'
Executing 'app.handler' in function directory '/opt'
END RequestId: 0737419e-378e-4989-8d59-e54092369fed
REPORT RequestId: 0737419e-378e-4989-8d59-e54092369fed	Duration: 5804.95 ms	Billed Duration: 5805 ms	Memory Size: 128 MB	Max Memory Used: 18 MB	
RequestId: 0737419e-378e-4989-8d59-e54092369fed Error: Runtime exited with error: exit status 1
Runtime.ExitError

My dockerfile:

# Define function directory
ARG LAYER_DIR="/opt"

FROM lambci/lambda-base:build as build-image

# Install aws-lambda-cpp build dependencies
RUN yum -y install \
  g++ \
  make \
  cmake \
  unzip \
  libcurl4-openssl-dev

# Include global arg in this stage of the build
ARG LAYER_DIR
# Create function directory
RUN mkdir -p ${LAYER_DIR}
# Install the runtime interface client
RUN pip install \
        --target ${LAYER_DIR} \
        awslambdaric

# Add layer start
ARG AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-"cn-northwest-1"}
ARG AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-"xxxx"}
ARG AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-"xxxx"}
ENV AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}
ENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}

RUN yum install -y curl unzip

RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
RUN unzip awscliv2.zip
RUN ./aws/install

# layer1
RUN curl $(aws lambda get-layer-version-by-arn --arn arn:aws-cn:lambda:cn-northwest-1:xxxx:layer:xxxx:3 --query 'Content.Location' --output text) --output layer.zip
RUN unzip layer.zip -d ${LAYER_DIR}
RUN rm layer.zip

# layer2
RUN curl $(aws lambda get-layer-version-by-arn --arn arn:aws-cn:lambda:cn-northwest-1:xxxx:layer:xxxx:1 --query 'Content.Location' --output text) --output layer.zip
RUN unzip layer.zip -d ${LAYER_DIR}
RUN rm layer.zip
# Add layer done


# Multi-stage build: grab a fresh copy of the base image, use custom image instead of official one
FROM python:buster

# Include global arg in this stage of the build
ARG LAYER_DIR

# Copy in the build image dependencies
WORKDIR ${LAYER_DIR}
COPY --from=build-image ${LAYER_DIR} .

COPY app.py .

ADD https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie /usr/bin/aws-lambda-rie
RUN chmod 755 /usr/bin/aws-lambda-rie

COPY entry.sh /
RUN chmod 755 /entry.sh

# Production env
ENTRYPOINT [ "/entry.sh" ]
CMD [ "app.handler" ]

And entry.sh embedded

#!/bin/sh
if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then
    exec /usr/bin/aws-lambda-rie /usr/local/bin/python -m awslambdaric $1
else
    exec /usr/local/bin/python -m awslambdaric $1
fi

Unexpected empty response when lambda function's process terminates

The RIE behaves differently from the "production" AWS Lambda environment when a Lambda function's process terminates.

Concretely, the production environment responds with a message that contains the process's exit status, e.g.:

{
  "errorType": "Runtime.ExitError",
  "errorMessage": "RequestId: 7f399cc8-8841-fefa-0af7-ba803f3f21e3 Error: Runtime exited with error: exit status 42"
}

The Lambda RIE however does not send such a response. Instead, when the Lambda function's process terminates, the RIE only responds with an empty response body, which does not resemble the behavior of the production environment.

Support for emulating ALB?

More of a question or perhaps a feature request, but does it support emulating an ALB? I'm returning a ALBTargetGroupResponse struct from the github.com/aws/aws-lambda-go/events package:

return events.ALBTargetGroupResponse{
    Body:       "Not Found",
    StatusCode: 404,
}

When I make a request of the emulator I get a 200 response back:

< HTTP/1.1 200 OK
< Date: Mon, 07 Dec 2020 20:48:02 GMT
< Content-Length: 124
< Content-Type: text/plain; charset=utf-8
< 
* Connection #0 to host localhost left intact
{"statusCode":404,"statusDescription":"","headers":null,"multiValueHeaders":null,"body":"Not Found","isBase64Encoded":false}* Closing connection 0

Is there a way to get the emulator to return the http response as you would receive if an ALB had invoked the lambda? If not are there any plans to support this in the future?

Thanks

Tom

Change timeout?

Is it possible to change the timeout using the RIE? Currently it seems that it is set to 300s, however the Lambda functions can now run up to 15 minutes

Mimicking provisioned Lambda behavior

When provisioned lambdas boot they preload the environment without invoking the handler. Is there a way to have the RIE perform the same behavior?

Wrong HTTP status for timeout?

With a simple Dockerfile that always times out after 1s:

FROM public.ecr.aws/lambda/nodejs:12
RUN echo 'exports.handler = (_event, _context, cb) => { setTimeout(() => {}, 100000) }' > index.js
ENV AWS_LAMBDA_FUNCTION_TIMEOUT=1
CMD ["index.handler"]

Hitting the endpoint:

$ curl -qv http://localhost:8080/2015-03-31/functions/function/invocations -d '{}'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> POST /2015-03-31/functions/function/invocations HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Length: 2
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 2 out of 2 bytes
< HTTP/1.1 200 OK
< Date: Tue, 19 Jan 2021 02:38:17 GMT
< Content-Length: 33
< Content-Type: text/plain; charset=utf-8
< 
* Connection #0 to host localhost left intact
Task timed out after 1.00 seconds* Closing connection 0

Returns status code 200 and no special response headers.

I didn't find conclusive documentation on what exactly should happen, but the screenshot on this page seems to suggest that a "real" lambda would return 502.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.