Skip to content

Commit 684c317

Browse files
Update README with correct handler usage and deprecation message
2 parents 70a2045 + b521b7c commit 684c317

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ You can include this package in your preferred base image to make that base imag
1111

1212
## Requirements
1313
The Ruby Runtime Interface Client package currently supports ruby 3.0 and above.
14+
15+
## Migration from 2.x to 3.x
16+
17+
**Important**: Version 2.x is deprecated. Please upgrade to version 3.x. For more information about Lambda runtime support, see the [AWS Lambda runtimes documentation](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).
18+
19+
**Breaking Change**: Version 3.0.0 introduced a change in how the handler is specified:
20+
21+
- **Version 2.x**: Handler was passed as a command line argument
22+
- **Version 3.x+**: Handler must be specified via the `_HANDLER` environment variable
23+
24+
If you're upgrading from 2.x, update your Dockerfile to use the `_HANDLER` environment variable instead of relying on `CMD` arguments.
1425

1526
## Usage
1627

@@ -39,7 +50,9 @@ Or install it manually as:
3950

4051
The next step would be to copy your Lambda function code into the image's working directory.
4152
You will need to set the `ENTRYPOINT` property of the Docker image to invoke the Runtime Interface Client and
42-
then set the `CMD` argument to specify the desired handler.
53+
set the `_HANDLER` environment variable to specify the desired handler.
54+
55+
**Important**: The Runtime Interface Client requires the handler to be specified via the `_HANDLER` environment variable.
4356

4457
Example Dockerfile:
4558
```dockerfile
@@ -57,23 +70,16 @@ RUN gem install bundler
5770
# Install the Runtime Interface Client
5871
RUN gem install aws_lambda_ric
5972

60-
# If you want to install Runtime Interface Client From Source, you can uncomment the following `ADD` and `RUN` layers.
61-
# Do not forget to comment/remove the above `RUN gem install aws_lambda_ric` command.
62-
# ADD https://github.com/aws/aws-lambda-ruby-runtime-interface-client.git /aws_lambda_ric
63-
# RUN cd /aws_lambda_ric && \
64-
# make init && \
65-
# make build && \
66-
# gem install --local /aws_lambda_ric/pkg/aws_lambda_ric-3.0.0.gem && \
67-
# rm -rf /aws_lambda_ric
68-
6973
# Copy function code
7074
RUN mkdir -p ${FUNCTION_DIR}
7175
COPY app.rb ${FUNCTION_DIR}
7276

7377
WORKDIR ${FUNCTION_DIR}
7478

79+
# Set the handler via environment variable
80+
ENV _HANDLER="app.App::Handler.process"
81+
7582
ENTRYPOINT ["/usr/local/bin/aws_lambda_ric"]
76-
CMD ["app.App::Handler.process"]
7783
```
7884

7985
Note that the `ENTRYPOINT` may differ based on the base image used. You can find the correct path by running an
@@ -119,9 +125,10 @@ mkdir -p ~/.aws-lambda-rie && \
119125

120126
```shell script
121127
docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 \
128+
-e _HANDLER="app.App::Handler.process" \
122129
--entrypoint /aws-lambda/aws-lambda-rie \
123130
myfunction:latest \
124-
/usr/local/bin/aws_lambda_ric app.App::Handler.process
131+
/usr/local/bin/aws_lambda_ric
125132
```
126133

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

0 commit comments

Comments
 (0)