Skip to content

Commit 4a96ab3

Browse files
authored
Document local debug with sam local (#189)
1 parent 21c4a98 commit 4a96ab3

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ AWS Lambda Web Adapter also works with AWS managed Lambda runtimes. You need to
6262

6363
For details, please check out [the example nodejs application](examples/expressjs-zip).
6464

65-
### Readiness Check
65+
## Readiness Check
6666

6767
When a new Lambda Execution Environment starts up, Lambda Web Adapter will boot up as a Lambda Extension, followed by the web application.
6868

@@ -74,7 +74,7 @@ In addition, you can configure the adapter to preform readiness check with TCP c
7474

7575
After passing readiness check, Lambda Web Adapter will start Lambda Runtime and forward the invokes to the web application.
7676

77-
### Configurations
77+
## Configurations
7878

7979
The readiness check port/path and traffic port can be configured using environment variables. These environment variables can be defined either within docker file or as Lambda function configuration.
8080

@@ -122,12 +122,21 @@ It supports TLS1.2 and TLS1.3 with safe defaults. To see the supported TLS featu
122122
Please check out [FastAPI with Https](examples/fastapi-https/) example for more details.
123123

124124

125-
### Request Context
125+
## Request Context
126126

127127
**Request Context** is metadata API Gateway sends to Lambda for a request. It usually contains requestId, requestTime, apiId, identity, and authorizer. Identity and authorizer are useful to get client identity for authorization. API Gateway Developer Guide contains more details [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format).
128128

129-
Lambda Web Adapter forwards this information to the web applicatioin in a Http Header named "x-amzn-request-context". In the web application, you can retrieve the value of this http header and deserialize it into a JSON object. Check out [Express.js in Zip](examples/expressjs-zip) on how to use it.
129+
Lambda Web Adapter forwards this information to the web application in a Http Header named "x-amzn-request-context". In the web application, you can retrieve the value of this http header and deserialize it into a JSON object. Check out [Express.js in Zip](examples/expressjs-zip) on how to use it.
130130

131+
## Local Debugging
132+
133+
Lambda Web Adapter allows developers to develop web applications locally with familiar tools and debuggers. If you want to simulate Lambda Runtime environment locally, you can use AWS SAM CLI. The following command starts a local api gateway endpoint and simulate the Lambda runtime execution environment.
134+
135+
```bash
136+
sam local start-api
137+
```
138+
139+
Please note that `sam local` starts a Lambda Runtime Interface Emulator on port 8080. So your web application should avoid port `8080` if you plan to use `sam local`.
131140

132141
## Examples
133142

0 commit comments

Comments
 (0)