Skip to content

Commit 026318c

Browse files
committed
fix(docs): examples/extension-internal-flush: don't refer to a standalone layer arn for internal extension deploy, add testing information
1 parent c511046 commit 026318c

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

examples/extension-internal-flush/README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,29 @@ the Lambda service returns the response to the caller immediately. Extensions ma
1818
without introducing an observable delay.
1919

2020
## Build & Deploy
21+
Two deploy options for internal extensions:
2122

2223
1. Install [cargo-lambda](https://github.com/cargo-lambda/cargo-lambda#installation)
23-
2. Build the extension with `cargo lambda build --release`
24+
2. Build a function with the internal extension embedded with `cargo lambda build --release`
2425
3. Deploy the function to AWS Lambda with `cargo lambda deploy --iam-role YOUR_ROLE`
2526

2627
The last command will give you an ARN for the extension layer that you can use in your functions.
2728

2829
## Build for ARM 64
2930

3031
Build the extension with `cargo lambda build --release --arm64`
32+
33+
34+
## Test your Function
35+
36+
From your local:
37+
```
38+
cargo lambda watch
39+
# in new terminal window
40+
cargo lambda invoke --data-ascii '{"Records":[{"messageId":"MessageID_1","receiptHandle":"MessageReceiptHandle","body":"{\"a\":\"Test\",\"b\":123}"}]}'
41+
```
42+
43+
If you have deployed to AWS using the commands in the 'Build & Deploy' section, you can also invoke your function remotely:
44+
```
45+
cargo lambda invoke extension-internal-flush --remote --data-ascii '{"Records":[{"messageId":"MessageID_1","receiptHandle":"MessageReceiptHandle","body":"{\"a\":\"Test\",\"b\":123}"}]}'
46+
```

examples/extension-internal-flush/src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ async fn main() -> Result<(), Error> {
101101

102102
let handler = Arc::new(EventHandler::new(request_done_sender));
103103

104+
// TODO: add biased! to always poll the handler future first, once supported:
105+
// https://github.com/tokio-rs/tokio/issues/7304
104106
tokio::try_join!(
105107
lambda_runtime::run(service_fn(|event| {
106108
let handler = handler.clone();

0 commit comments

Comments
 (0)