cdk-local-lambda 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +38 -24
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,10 +1,15 @@
1
- # Run lambdas in CDK stack locally
1
+ # cdk-local-lambda
2
2
 
3
- Run typescript and docker lambdas in a CDK stack locally. This
4
- improves the DX as you can edit lambdas and see changes and fixes
5
- immediately.
3
+ Run Lambda functions from your CDK stack locally. Edit your code and see changes immediately—no redeployment required.
6
4
 
7
- Needs two minor changes to a CDK stack, and the supplied cli to launch it.
5
+ ## Supported Runtimes
6
+
7
+ | Runtime | Status |
8
+ |---------|--------|
9
+ | TypeScript / JavaScript | Supported |
10
+ | Docker | Supported |
11
+ | Python | Not yet supported |
12
+ | Java | Not yet supported |
8
13
 
9
14
  ## Installation
10
15
 
@@ -12,18 +17,21 @@ Needs two minor changes to a CDK stack, and the supplied cli to launch it.
12
17
  npm install cdk-local-lambda
13
18
  ```
14
19
 
15
- ## Usage
20
+ ## Quick Start
21
+
22
+ Setting up local Lambda development requires three steps:
23
+
24
+ 1. Load the bootstrap module
25
+ 2. Apply the LiveLambda aspect
26
+ 3. Start the local daemon
16
27
 
17
- ### 1. Add the bootstrap to your CDK app
28
+ ### 1. Load the bootstrap module
18
29
 
19
- Unfortunately CDK hides lambda internals which we need to know. Until
20
- CDK accepts our patch to improve this, you need to live patch
21
- CDK. This depends on how you run your CDK app.
30
+ The bootstrap module patches CDK internals to enable local execution. The loading method depends on your runtime.
22
31
 
23
- #### tsx/ts-node
32
+ #### tsx / ts-node
24
33
 
25
- In your CDK app entry point (e.g., `bin/app.ts`), add the bootstrap as
26
- the every first entry:
34
+ In your CDK app entry point (e.g., `bin/app.ts`), import the bootstrap module before any other imports:
27
35
 
28
36
  ```typescript
29
37
  import "cdk-local-lambda/bootstrap" // Must be first import!
@@ -32,9 +40,9 @@ import * as cdk from "aws-cdk-lib"
32
40
 
33
41
  #### Bun
34
42
 
35
- If you run your CDK app with Bun, you must preload the bootstrap. Bun snapshots CommonJS named exports during static ESM import linking, so a normal `import "cdk-local-lambda/bootstrap"` in your app entry point is too late.
43
+ Bun requires preloading the bootstrap module because it snapshots CommonJS exports during static ESM import linking. A regular import statement runs too late.
36
44
 
37
- Add a `--preload` command to `cdk.json`:
45
+ Add the `--preload` flag to your `cdk.json`:
38
46
 
39
47
  ```json
40
48
  {
@@ -42,9 +50,9 @@ Add a `--preload` command to `cdk.json`:
42
50
  }
43
51
  ```
44
52
 
45
- ### 2. Add the aspect to your CDK app
53
+ ### 2. Apply the LiveLambda aspect
46
54
 
47
- In your CDK app entry point (e.g., `bin/app.ts`):
55
+ In your CDK app entry point (e.g., `bin/app.ts`), apply the aspect after defining your stacks:
48
56
 
49
57
  ```typescript
50
58
  import "cdk-local-lambda/bootstrap" // Must be first import!
@@ -61,19 +69,19 @@ app.synth()
61
69
 
62
70
  ### 3. Start the local daemon
63
71
 
64
- The daemon deploys your stack with live mode enabled and runs your Lambda functions locally:
72
+ The daemon deploys your stack with live mode enabled and runs Lambda functions locally:
65
73
 
66
74
  ```bash
67
75
  npx cll local
68
76
  ```
69
77
 
70
- If you have multiple stacks:
78
+ For multiple stacks, specify which one to use:
71
79
 
72
80
  ```bash
73
81
  npx cll local --stacks MyStack
74
82
  ```
75
83
 
76
- Use `--profile` and `--region` to specify AWS credentials:
84
+ To specify AWS credentials:
77
85
 
78
86
  ```bash
79
87
  npx cll local --stacks MyStack --profile my-profile --region us-west-2
@@ -81,14 +89,20 @@ npx cll local --stacks MyStack --profile my-profile --region us-west-2
81
89
 
82
90
  ### Manual bootstrap (optional)
83
91
 
84
- If you prefer to deploy the bootstrap stack separately:
92
+ To deploy the bootstrap stack separately:
85
93
 
86
94
  ```bash
87
95
  npx cll bootstrap --profile my-profile --region us-west-2
88
96
  ```
89
97
 
90
- ## Common issues
98
+ ## Troubleshooting
99
+
100
+ ### "No functions found with live-lambda tags yet"
101
+
102
+ This error appears when the bootstrap module or aspect is not configured correctly.
91
103
 
92
- 1. You see: "No functions found with live-lambda tags yet. Have you patched your CDK project (bootstrap) and added the LiveLambdaAspect?"
104
+ **Checklist:**
93
105
 
94
- Make sure your CDK app loads `cdk-local-lambda/bootstrap` (Bun: use `--preload cdk-local-lambda/bootstrap`) and that you call `applyLiveLambdaAspect(app)` in your app entry point.
106
+ - Verify that `cdk-local-lambda/bootstrap` is loaded (use `--preload` for Bun)
107
+ - Confirm that `applyLiveLambdaAspect(app)` is called in your app entry point
108
+ - Ensure the aspect is applied after all stacks are defined
package/package.json CHANGED
@@ -85,7 +85,7 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "version": "0.0.6",
88
+ "version": "0.0.7",
89
89
  "bugs": {
90
90
  "url": "https://github.com/processfocus/cdk-local-lambda/issues"
91
91
  },