Skip to content

Commit 3f26c19

Browse files
authored
Merge pull request #29 from softprops/invoke-local
invoke local support
2 parents 3061faa + a04b97a commit 3f26c19

File tree

10 files changed

+4209
-336
lines changed

10 files changed

+4209
-336
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# ⚡ 0.3.2 (unreleased)
2+
3+
- ✨new support for invoking your lambdas locally.
4+
5+
This decreases the turn around time to validate a change before
6+
without having to deploy it first
7+
8+
```sh
9+
$ npx serverless invoke local -f foo -d '{"yes":"we can"}'
10+
```
11+
12+
You can still use this plugin with older versions of serverless but `invoke local` will only work with `[email protected]` and above
13+
114
# ⚡ 0.3.1
215

316
- bump [lambda-rust](https://hub.docker.com/r/softprops/lambda-rust/) docker version to 0.2.1-rust-1.33.0

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ functions:
3939
method: GET
4040
```
4141
42-
> 💡 The Rust Lambda runtime requires a binary named `bootstrap`. This plugin renames the binary cargo builds to `bootstrap` for you before packaging. You do not need to do this manually in your Cargo configuration.
42+
> 💡 The Rust Lambda runtime requires a binary named `bootstrap`. This plugin renames the binary cargo builds to `bootstrap` for you before packaging. You do **not** need to do this manually in your Cargo configuration.
4343

4444
## 🖍️ customize
4545

@@ -80,6 +80,34 @@ functions:
8080
method: GET
8181
```
8282
83+
## 🤸 usage
84+
85+
Every [serverless workflow command](https://serverless.com/framework/docs/providers/aws/guide/workflow/) should work out of the box.
86+
87+
### invoke your lambdas locally
88+
89+
```sh
90+
$ npx serverless invoke local -f hello -d '{"hello":"world"}'
91+
```
92+
93+
### deploy your lambdas to the cloud
94+
95+
```sh
96+
$ npx serverless deploy
97+
```
98+
99+
### invoke your lambas in the cloud directly
100+
101+
```sh
102+
$ npx serverless invoke -f hello -d '{"hello":"world"}'
103+
```
104+
105+
### view your lambdas logs
106+
107+
```sh
108+
$ npx serverless logs -f hello
109+
```
110+
83111

84112
## 🏗️ serverless templates
85113

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class RustPlugin {
2020
this.servicePath = this.serverless.config.servicePath || "";
2121
this.hooks = {
2222
"before:package:createDeploymentArtifacts": this.build.bind(this),
23-
"before:deploy:function:packageFunction": this.build.bind(this)
23+
"before:deploy:function:packageFunction": this.build.bind(this),
24+
'before:invoke:local:invoke': this.build.bind(this),
2425
};
2526
this.custom = Object.assign(
2627
{

package-lock.json

Lines changed: 80 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
"dependencies": {
2626
"fs-copy-file-sync": "^1.1.1",
2727
"fs-extra": "^7.0.1",
28-
"serverless": "^1.37.1",
28+
"serverless": "^1.39.1",
2929
"test": "^0.6.0"
3030
},
3131
"devDependencies": {
32-
"eslint": "^5.14.0"
32+
"eslint": "^5.15.3"
3333
},
3434
"files": [
3535
"index.js",

tests/test-func/local-out.log

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"baz":"boom"}

0 commit comments

Comments
 (0)