Skip to content

Commit 9539269

Browse files
fix: improve documentation and logging
1 parent 31673fb commit 9539269

File tree

3 files changed

+39
-29
lines changed

3 files changed

+39
-29
lines changed

README.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,32 @@ It supports the following frameworks:
1919

2020
**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 people can configure their projects and TypeScript settings in numerous ways. The tool is flexible and can be adjusted to fit your setup in most cases without needing additional features. If you need help, please let me know. Any suggestions for improvements are welcome.**
2121

22-
Contact me via:
22+
If the tool is working well for you, please fill out the general [FEEDBACK FORM](https://forms.gle/v6ekZtuB45Rv3EyW9). This helps us understand how extensively the tool has been tested and whether there is a general interest in its further development.
23+
24+
If you've encountered a bug, need help, or would like to request additional features, please create an issue on [GitHub Issue](https://github.com/ServerlessLife/lambda-live-debugger/issues).
2325

26+
Contact me via:
27+
- [Feedback Form](https://forms.gle/v6ekZtuB45Rv3EyW9)
2428
- [GitHub Issues](https://github.com/ServerlessLife/lambda-live-debugger/issues)
2529
- [LinkedIn](http://www.linkedin.com/in/marko-serverlesslife)
2630

2731
## The Problem Statement
2832

29-
Serverless is amazing and solves many issues with traditional systems. However, 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.
33+
Serverless is amazing and solves many issues with traditional systems. However, writing code for Lambda functions can be challenging. The cycle of writing, deploying, running, fixing, and redeploying is time-consuming and tedious. You could use tools to run Lambda locally or use unit/integration tests; those approaches often don't replicate the actual environment closely enough.
3034

3135
## How It Works
3236

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.
37+
Lambda Live Debugger connects to your deployed Lambda, routes requests to your computer, and sends responses back to the deployed Lambda. This allows you to debug locally, but the system behaves as if the code is running in the cloud with the same permissions.
3438

35-
The tool attaches Lambda Extensions (via a Layer) to intercept and relay calls to AWS IoT, transferring 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 Thread.
39+
The tool attaches Lambda Extensions (via a Layer), intercepts, and relays calls to AWS IoT. AWS IoT 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 the Node Worker Thread.
3640

3741
![Architecture](./architecture.drawio.png)
3842

3943
### Infrastructure Changes
4044

4145
Lambda Live Debugger makes the following changes to your AWS infrastructure:
4246

43-
- Adds Lambda Layer
47+
- Deploys Lambda Layer
4448
- Attaches the Layer to each Lambda you're debugging
4549
- Adds a policy to the Lambda Role for AWS IoT access
4650

@@ -71,7 +75,7 @@ _(On Linux and Mac: `sudo npm install lambda-live-debugger -g`)_
7175
or locally
7276

7377
```
74-
npm install lambda-live-debugger -g
78+
npm install lambda-live-debugger
7579
```
7680

7781
_(If installed locally, you must prefix all commands with `npx`, if they are not part of `scripts` in `package.json`.)_
@@ -116,17 +120,17 @@ The configuration is saved to `lldebugger.config.ts`.
116120

117121
## Configuration file lldebugger.config.ts
118122

119-
Example lldebugger.config.ts:
123+
Example `lldebugger.config.ts`:
120124

121125
```typescript
122126
import { type LldConfigTs } from "lambda-live-debugger";
123127

124128
export default {
125-
framework: "cdk",
126-
context: ["environment=development"],
127-
region: "eu-central-1",
128-
observable: false,
129-
verbose: false,
129+
framework: "cdk",
130+
context: ["environment=development"],
131+
region: "eu-central-1",
132+
observable: false,
133+
verbose: false,
130134
//getLambdas: async (foundLambdas) => {
131135
// you can customize the list of lambdas here or create your own
132136
// return foundLambdas;
@@ -138,10 +142,12 @@ The setting are the same as for CLI parameters.
138142

139143
### Custom framework implementation and adjustment
140144

145+
```typescript
141146
getLambdas: async (foundLambdas) => {
142147
//you can customize the list of lambdas here or create your own
143148
//return foundLambdas;
144149
},
150+
```
145151

146152
### Debugging
147153

@@ -151,7 +157,7 @@ You might want to configure your development tool for debugging. The wizard auto
151157
{
152158
"version": "0.2.0",
153159
"configurations": [
154-
{
160+
{
155161
"name": "Lambda Live Debugger",
156162
"type": "node",
157163
"request": "launch",
@@ -160,8 +166,8 @@ You might want to configure your development tool for debugging. The wizard auto
160166
"console": "integratedTerminal",
161167
"skipFiles": ["<node_internals>/**"],
162168
"env": {}
163-
}
164-
]
169+
}
170+
]
165171
}
166172
```
167173

@@ -209,18 +215,19 @@ I am not a Terraform developer, so I only know the basics. Please provide a samp
209215

210216
## Know issues
211217

212-
...
218+
Check the [GitHub issues](https://github.com/ServerlessLife/lambda-live-debugger/issues).
213219

214220
## Missing Features
215221

216-
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.
222+
Check the [GitHub issues](https://github.com/ServerlessLife/lambda-live-debugger/issues). The biggest missing feature right now is MFA authentication and more Terraform configurations.
217223

218224
## Reporting an Issue
219225

220-
- Make sure the bug hasn't already been reported. Add a "+1" comment so I know there are multiple users struggling with the same issue. If possible, add some additional info.
221-
- Use descriptive titles with prefixes like "bug:", "help:", "feature:", or "discussion:". Please also add the matching label and, if needed, set priority via a label.
226+
- Make sure the bug hasn't already been reported. If you fount if, add a "+1" comment so I know there are multiple users struggling with the same issue. If possible, add some additional info.
227+
- Use descriptive titles with prefixes like "bug:", "help:", "feature:", or "discussion:".
222228
- Enable verbose logging and provide the full log.
223229
- Describe your setup in detail, or better yet, provide a sample project.
230+
- Specify exact framework version (CDK, SLS, SAM ...) and exact version of Lambda Live Debugger version.
224231

225232
## Authors:
226233

@@ -229,7 +236,7 @@ Check the [open issues](https://github.com/ServerlessLife/lambda-live-debugger/i
229236

230237
## Contributors (alphabetical)
231238

232-
- ⭐ Your name here for smaller code/documentation contributions or sample projects as part of bug reports
239+
- ⭐ Your name here for documentation contributions, minor code additions, or sample projects submitted with bug reports.
233240

234241
## Declarment
235242

src/infraDeploy.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,15 @@ async function deployLayer() {
151151
});
152152
await getLambdaClient().send(deleteLayerVersionCommand);
153153
} else {
154-
Logger.log(`${layerDescription} already deployed.`);
154+
Logger.verbose(`${layerDescription} already deployed.`);
155155
return existingLayer.LayerVersionArn;
156156
}
157157
}
158158

159159
// Read the ZIP file containing your layer code
160160
const layerContent = await fs.readFile(layerZipPathFullPath);
161161

162-
Logger.log(`Deploying ${layerDescription}`);
162+
Logger.verbose(`Deploying ${layerDescription}`);
163163

164164
// Create the command for publishing a new layer version
165165
const publishLayerVersionCommand = new PublishLayerVersionCommand({
@@ -424,7 +424,7 @@ async function attachLayerToLambda(
424424
// check if layers with the wrong version are attached
425425
if (!needToUpdate && ddlLayerArns.find((arn) => arn !== layerArn)) {
426426
needToUpdate = true;
427-
Logger.log("Layer with the wrong version attached to the function");
427+
Logger.verbose("Layer with the wrong version attached to the function");
428428
}
429429

430430
const ddlEnvironmentVariables = getEnvironmentVarablesForDebugger(
@@ -458,7 +458,7 @@ async function attachLayerToLambda(
458458

459459
await getLambdaClient().send(updateFunctionConfigurationCommand);
460460

461-
Logger.log(
461+
Logger.verbose(
462462
`[Function ${functionName}] Lambda layer and environment variables updated`,
463463
);
464464
} catch (error: any) {
@@ -468,7 +468,7 @@ async function attachLayerToLambda(
468468
);
469469
}
470470
} else {
471-
Logger.log(
471+
Logger.verbose(
472472
`[Function ${functionName}] Lambda layer and environment already up to date`,
473473
);
474474
}
@@ -517,7 +517,7 @@ async function addPolicyToLambdaRole(functionName: string) {
517517

518518
if (addPolicy) {
519519
// add inline policy to the role using PutRolePolicyCommand
520-
Logger.log(
520+
Logger.verbose(
521521
`[Function ${functionName}] Attaching policy to the role ${roleName}`,
522522
);
523523

@@ -586,7 +586,7 @@ async function removePolicyFromLambdaRole(functionName: string) {
586586

587587
if (existingPolicy) {
588588
try {
589-
Logger.log(
589+
Logger.verbose(
590590
`[Function ${functionName}] Removing policy from the role ${roleName}`,
591591
);
592592
await getIAMClient().send(
@@ -602,7 +602,7 @@ async function removePolicyFromLambdaRole(functionName: string) {
602602
);
603603
}
604604
} else {
605-
Logger.log(
605+
Logger.verbose(
606606
`[Function ${functionName}] No need to remove policy from the role ${roleName}, policy not found`,
607607
);
608608
}

src/lldebugger.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ import { LambdaConnection } from "./lambdaConnection.js";
2323
async function run() {
2424
const version = await getVersion();
2525

26-
Logger.log(`Welcome to Lambda Live Debugger version ${version}`);
26+
Logger.log(`Welcome to Lambda Live Debugger version ${version}.`);
27+
Logger.log(
28+
"To keep the project moving forward, please fill out the feedback form at https://forms.gle/v6ekZtuB45Rv3EyW9. Your input is greatly appreciated!",
29+
);
2730

2831
await Configuration.readConfig();
2932

0 commit comments

Comments
 (0)