You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lambda Live Debugger is an indispensable tool that allows you to debug AWS Lambda from your computer, although it is deployed on the cloud. It supports Lambdas written in JavaScript or TypeScript.
5
+
Lambda Live Debugger is an indispensable tool for debugging AWS Lambda functions from your computer, even though they are deployed in the cloud. It supports Lambdas written in JavaScript or TypeScript.
6
6
7
-
This is essentially the same as offered by [SST](https://sst.dev/) and [Serverless Framework v4](https://www.serverless.com/blog/serverless-framework-v4-general-availability), except it supports an additional Obserability mode.
7
+
This tool offers similar functionality to [SST](https://sst.dev/) and [Serverless Framework v4](https://www.serverless.com/blog/serverless-framework-v4-general-availability), with the addition of an Observability mode.
8
8
9
9
It supports the following frameworks:
10
10
11
-
- AWS CDK v2,
12
-
- Serverless Framework v3 (SLS),
13
-
- AWS Serverless Application Model (SAM),
14
-
- Terraform,
15
-
- by implementing a simple function and option to support any framework or setup you might have,
16
-
- ... (if you need any other framework, let me know?)
11
+
- AWS CDK v2
12
+
- Serverless Framework v3 (SLS)
13
+
- AWS Serverless Application Model (SAM)
14
+
- Terraform
15
+
-Any other framework or setup by implementing a simple function in TypeScript
16
+
- ... (Need support for another framework? Let me know!)
17
17
18
-
## Early alpha state
18
+
## Early Alpha State
19
19
20
-
**Currently, the project is in the early alpha state. Please let me know if everything works for you. A simple message would help a lot, so I know I am on the right track. I tested many scenarios, but there are numerous ways how people can configure projects and TypeScript configuration. The tool is flexible enough, so the settings can be tweaked to adjust your setup without implementing additional features. Any advice on how to improve the project is also very welcome.**
20
+
**This project is in the early alpha stage. Your feedback is incredibly valuable. Please let me know if it works for you or if you encounter any issues. I've tested many scenarios, but there are numerous ways people configure their projects and TypeScript settings. The tool is flexible and can be adjusted to fit your setup in most cases without needing additional features. If you got stuck, please let me know. Any suggestions for improvements are welcome.**
The serverless is amazing and resolves many issues that regular systems face. But writing code can be a struggle. You write code, deploy, run, fix, deploy again. That process is time-consuming and tiresome. You can also use one of the tools for running code locally or use unit/integration tests for that, but that has many other issues, and it does not mimic an actual environment close enough.
29
+
Serverless is amazing and solve many issues with traditional systems. But writing code for Lambda functions can be challenging. The cycle of writing, deploying, running, fixing, and redeploying is time-consuming and tedious. While local testing tools and unit/integration tests exist, they often don't replicate the actual environment closely enough.
30
30
31
-
## How does it work
31
+
## How It Works
32
32
33
-
It connects to your deployed Lambda, sends the request to your computer, and sends the response back to Lambda. This way, you can debug on your machine, but the system behaves as if the code is running in the cloud with the same permissions.
33
+
Lambda Live Debugger connects to your deployed Lambda, routes requests to your computer, and sends responses back to the Lambda. This allows you to debug locally, but the system behaves as if the code is running in the cloud with the same permissions.
34
34
35
-
Lambda Live Debugger attaches Lambda Extensions (via Layer) to the Lambda to intercept calls and send them to AWS IoT. AWS IoT is used to transfer messages to and from your machine. Lambda Live Debugger runs locally, connects to the AWS IoT, and executes the code locally. If Lambda is written in TypeScript, it is transpiled to JavaScript. Calls are executed via Node Worker Threads.
35
+
The tool attaches Lambda Extensions (via a Layer) to intercept calls and relay them to AWS IoT, which transfers messages between your Lambda and local machine. If the Lambda is written in TypeScript, it's transpiled to JavaScript. The code is executed via Node Worker Threads.
36
36
37
37

38
38
39
-
Lambda Live Debugger makes the following changes to your AWS infrastructure:
39
+
### Infrastructure Changes
40
40
41
-
- Lambda excentions as a Layer
42
-
- Attach Layer to each Lambda that you are debugging
43
-
- Add policy to Lambda Role to use AWS IoT
41
+
Lambda Live Debugger makes the following changes to your AWS infrastructure:
44
42
45
-
In case you do not want to add Layer to all functions, you can limit to the ones you need via configuration parameters.
43
+
- Adds Lambda Layer
44
+
- Attaches the Layer to each Lambda you're debugging
45
+
- Adds a policy to the Lambda Role for AWS IoT access
46
46
47
-
While compiling, it creates many temporary files in the folder `.lldebugger`; you can freely delete the folder once you are done debugging or add `.lldebugger` to `.gitignore`. The wizard adds that for you if you want.
47
+
In case you do not want to debug all functions and add Layer to them, you can limit to the ones you need via `function` parameter.
48
48
49
-
## Your developing process with Lambda Live Debugger
49
+
The tool generates temporary files in the `.lldebugger` folder, which can be deleted after debugging. The wizard can add `.lldebugger` to `.gitignore` for you.
50
50
51
-
Since you will be deploying code into an actual AWS account while developing, you must use that environment only for yourself or create a temporary environment for you or for a feature you are working on.
51
+
## Development Process
52
52
53
-
Unfortunately, having a separate AWS environment is not always possible because of organizational issues (it is 2024, and companies still do not understand how to work with serverless) or technical issues (it is hard to duplicate databases or other parts of the system). For that purpose, there is an Observability Mode.
53
+
Since you deploy code to a real AWS account, it's best to have a dedicated environment only for yourself. It could be your personla environemnt or environment created for a special feature. That is [common practice when developing serverless systems](https://theburningmonk.com/2019/09/why-you-should-use-temporary-stacks-when-you-do-serverless/). If that's not feasible due to organizational or technical reasons, use Observability Mode.
54
54
55
55
## Observability Mode
56
56
57
-
In Observability Mode, Lambda Live Debugger via Lambda Extension just intercepts the request received by Lambda and forwards it to the local environment, but it does not wait for the response. After that, Lambda continues regular execution and ignores the response from the local environment. The system is not impacted, and regular users and other developers can continue to use it. You can run Observability Mode on the development or testing environment. If you are an adventurer, you can even run it in production. In observability mode, you do not get all Lambda requests. You only get one every 3 seconds. You can configure that interval via `interval` setting. This way, the system will not be overloaded if there are a lot of requests coming in.
57
+
In Observability Mode, Lambda Live Debugger intercepts requests and sends them to your computer without waiting for a response. The Lambda continues as usual. The response from your machine is ignored. This mode can be used in development, testing, or even, if you are an adventures, production environments. It samples requestsevery 3 seconds by default (configurable with `interval` setting) to avoid overloading the system.
(On Linux and Mac: `sudo npm install lambda-live-debugger -g`)
76
+
77
+
Running the Tool
69
78
70
-
If you use the default profile, default region, and other default settings then just run:
79
+
With default profile, region, and other default settings:
71
80
72
-
`lld` or `npx lld` (if installed locally)
81
+
```
82
+
lld
83
+
```
84
+
85
+
or if installed locally:
86
+
87
+
```
88
+
npx lld
89
+
```
73
90
74
-
But you probably need to tweak some settings. You can do it via CLI parameters or, better run a wizard. The configuration is saved to `lldebugger.config.ts`
91
+
But you probably need to tweak some settings. You can do it via CLI parameters or, better run a wizard:
75
92
76
-
`npx lld -w` or `lld -w` (if installed globally)
93
+
```
94
+
lld -w
95
+
```
77
96
78
-
### CLI parameters
97
+
or if installed locally:
98
+
99
+
```
100
+
npx lld -w
101
+
```
102
+
103
+
The configuration is saved to `lldebugger.config.ts`
104
+
105
+
### CLI Parameters
79
106
80
107
```
81
108
-V, --version output the version number
@@ -102,34 +129,31 @@ But you probably need to tweak some settings. You can do it via CLI parameters o
102
129
103
130
You might want to configure your development tool for debugging. The wizard automatically configures for VsCode in `.vscode/launch.json`. Here is an example:
You can remove Lambda Live Debugger from your AWS account by running:
142
-
`lld -r` (`npx lld -r` if installed locally)
165
+
To remove Lambda Live Debugger from your AWS account
166
+
167
+
```
168
+
lld -r
169
+
```
170
+
171
+
or if installed locally:
143
172
144
-
This will detach the Layer from your Lambda and remove the additional IoT permission policy.
173
+
```
174
+
npx lld -r
175
+
```
176
+
177
+
This detaches the Layer from your Lambdas and removes the IoT permission policy. It will not remove the Layer as others might use it.
178
+
179
+
To also remove the Layer:
180
+
181
+
```
182
+
lld -r=all
183
+
```
184
+
185
+
or if installed locally:
186
+
187
+
```
188
+
npx lld -r=all
189
+
```
145
190
146
-
It will not remove the Layer as others might use it. You can do everything, including Layer, with:
147
-
`lld -r=all` (`npx lld -r=all` if installed locally)
191
+
## Framework-Specific Notes
148
192
149
-
## AWS CDK v2
193
+
###AWS CDK v2
150
194
151
-
`context`is an additional setting for CDK. This is a common way to pass various variables to your code, most often the environment name.
195
+
Use the `context`parameter to pass context to your CDK code. This is a common way to pass variables to your code, most often the environment name.
152
196
153
-
## Serverless Framework v3 (SLS)
197
+
###Serverless Framework v3 (SLS)
154
198
155
-
`stage`is an additional setting for SLS to pass the stage/environment name to SLS.
199
+
Use the `stage`parameter to pass the stage/environment name.
156
200
157
-
## AWS Serverless Application Model (SAM)
201
+
###AWS Serverless Application Model (SAM)
158
202
159
-
`config-env`is an additional setting for SAM to pass the stage/environment name to SLS.
203
+
Use the `config-env`parameter to pass the stage/environment name.
160
204
161
-
## Terraform
205
+
###Terraform
162
206
163
-
Only the most basic setup for Terraform is supported. Check the test case[in](https://github.com/ServerlessLife/lambda-live-debugger/tree/main/test/terraform-basic).
207
+
Only the basic setup is supported. Check the [test case](https://github.com/ServerlessLife/lambda-live-debugger/tree/main/test/terraform-basic).
164
208
165
-
I am not a Terraform developer, so I only know the basics. Please provide a project sample so I can build better support.
209
+
I am not a Terraform developer, so I only know the basics. Please provide a sample project so I can build better support.
166
210
167
211
## Know issues
168
212
169
-
## Missing features
213
+
...
170
214
171
-
Please check the open [issues](https://github.com/ServerlessLife/lambda-live-debugger/issues).
215
+
## Missing Features
172
216
173
-
The most important missing feature is MFA authentication and the most possible configuration for Terraform.
217
+
Check the [open issues](https://github.com/ServerlessLife/lambda-live-debugger/issues). The biggest missing feature right now is MFA authentication and more Terraform configurations.
174
218
175
-
## Reporting an issue
219
+
## Reporting an Issue
176
220
177
-
- Make sure the bug is not already reported. Add +1 comment so I know there are multiple users struggling with the same issue. If possible, add some additional info.
178
-
-Make a descriptive title with the prefix "bug:", "help:", "feature:", "discussion:" to indicate if you find a bug, need help, propose a feature... Please also add the matching label and, if needed, set priority via label.
179
-
-Turn on verbose logging and provide the whole log.
180
-
-Carefully describe your setup, or even better, provide a sample project.
221
+
- Make sure the bug isn't already reported. Add a "+1" comment so I know there are multiple users struggling with the same issue. If possible, add some additional info.
222
+
-Use descriptive titles with prefixes like "bug:", "help:", "feature:", or "discussion:". Please also add the matching label and, if needed, set priority via label.
223
+
-Enable verbose logging and provide the full log.
224
+
-Describe your setup in detail, or better yet, provide a sample project.
- ⭐ place for you for smaller code/documentation contributions or a sample project as a part of a bug report
233
+
- ⭐ Your name here for smaller code/documentation contributions or sample projects as part of bug reports
190
234
191
235
## Declarment
192
236
193
-
Use this tool at your responsibility...
237
+
Lambda Live Debugger is provided "as is", without warranty of any kind, express or implied. Use it at your own risk, and be mindful of potential impacts on performance, security, and costs when using it in your AWS environment.
0 commit comments