lambda-live-debugger 0.0.96 → 0.0.98

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.
@@ -20,10 +20,13 @@ export async function getConfigFromWizard({ supportedFrameworks, currentFramewor
20
20
  type: "list",
21
21
  name: "framework",
22
22
  message: `Which framework are you using (detected: ${currentFramework ?? "?"})?`,
23
- choices: supportedFrameworks,
23
+ choices: [...supportedFrameworks, "other"],
24
24
  default: currentConfig?.framework ?? currentFramework,
25
25
  },
26
26
  ]);
27
+ if (answers.framework === "other") {
28
+ answers.framework = undefined;
29
+ }
27
30
  const oldContext = currentConfig?.context ?? [];
28
31
  if (answers.framework === "cdk") {
29
32
  const cdkAnswers = await inquirer.prompt([
Binary file
@@ -7,7 +7,7 @@ import { findPackageJson } from "../utils/findPackageJson.mjs";
7
7
  import { CloudFormation } from "../cloudFormation.mjs";
8
8
  import { Logger } from "../logger.mjs";
9
9
  import { Worker } from "node:worker_threads";
10
- import { getModuleDirname } from "../getDirname.mjs";
10
+ import { getModuleDirname, getProjectDirname } from "../getDirname.mjs";
11
11
  import { Configuration } from "../configuration.mjs";
12
12
  /**
13
13
  * Support for AWS CDK framework
@@ -190,7 +190,7 @@ export class CdkFramework {
190
190
  });
191
191
  },
192
192
  };
193
- const compileOutput = path.resolve(`${outputFolder}/compiledCdk.js`);
193
+ const compileOutput = path.join(getProjectDirname(), outputFolder, `compiledCdk.js`);
194
194
  try {
195
195
  // Build CDK code
196
196
  await esbuild.build({
@@ -21,7 +21,7 @@ parentPort.on("message", async (data) => {
21
21
  const __dirname = path.resolve("./x"); // CDK needs this, pure magic
22
22
  eval(codeFile);
23
23
 
24
- if (global.lambdas.length === 0) {
24
+ if (!global.lambdas || global.lambdas?.length === 0) {
25
25
  throw new Error("No Lambda functions found in the CDK code");
26
26
  }
27
27
 
@@ -33,29 +33,15 @@ parentPort.on("message", async (data) => {
33
33
  path: lambda.code?.path,
34
34
  },
35
35
  cdkPath: lambda.node.defaultChild.node.path,
36
- bundling: lambda.bundling,
36
+ bundling: {
37
+ ...lambda.bundling,
38
+ commandHooks: undefined, // can not be serialized
39
+ },
37
40
  }));
38
41
 
39
- try {
40
- Logger.verbose(
41
- `[CDK] [Worker] Sending found lambdas`,
42
- JSON.stringify(lambdas, null, 2)
43
- );
44
- parentPort.postMessage(lambdas);
45
- } catch (error) {
46
- handleError(error);
47
- }
42
+ Logger.verbose(
43
+ `[CDK] [Worker] Sending found lambdas`,
44
+ JSON.stringify(lambdas, null, 2)
45
+ );
46
+ parentPort.postMessage(lambdas);
48
47
  });
49
-
50
- process.on("unhandledRejection", (error) => {
51
- Logger.error(`[CDK] [Worker] Unhandled Rejection`, error);
52
- handleError(error);
53
- });
54
-
55
- function handleError(error) {
56
- parentPort.postMessage({
57
- errorType: error.name ?? "Error",
58
- errorMessage: error.message,
59
- trace: error.stack,
60
- });
61
- }
@@ -114,13 +114,13 @@ async function deployLayer() {
114
114
  await getLambdaClient().send(deleteLayerVersionCommand);
115
115
  }
116
116
  else {
117
- Logger.verbose("Layer already deployed.");
117
+ Logger.log(`${layerDescription} already deployed.`);
118
118
  return existingLayer.LayerVersionArn;
119
119
  }
120
120
  }
121
121
  // Read the ZIP file containing your layer code
122
122
  const layerContent = await fs.readFile(layerZipPathFullPath);
123
- Logger.verbose(`Deploying ${layerDescription}`);
123
+ Logger.log(`Deploying ${layerDescription}`);
124
124
  // Create the command for publishing a new layer version
125
125
  const publishLayerVersionCommand = new PublishLayerVersionCommand({
126
126
  LayerName: layerName,
@@ -22,6 +22,7 @@ import { LambdaConnection } from "./lambdaConnection.mjs";
22
22
  */
23
23
  async function run() {
24
24
  const version = await getVersion();
25
+ Logger.log(`Welcome to Lambda Live Debugger version ${version}`);
25
26
  await Configuration.readConfig();
26
27
  Logger.setVerbose(Configuration.config.verbose === true);
27
28
  Logger.verbose(`Parameters: \n${Object.entries(Configuration.config)
@@ -38,7 +39,7 @@ async function run() {
38
39
  if (!Configuration.config.start && !Configuration.config.remove) {
39
40
  return;
40
41
  }
41
- Logger.log(`Welcome to Lambda Live Debugger version: ${version}! Starting the debugger
42
+ Logger.log(`Starting the debugger
42
43
  ${Configuration.config.observable
43
44
  ? "in observable mode"
44
45
  : `(ID ${Configuration.config.debuggerId})`}
@@ -148,7 +148,12 @@ async function build(input) {
148
148
  };
149
149
  // remove all undefined values just to make it cleaner
150
150
  removeUndefinedProperties(options);
151
- Logger.verbose(`[Function ${input.functionId}] Building ${handlerCodePath} with options:`, JSON.stringify(options, null, 2));
151
+ if (Configuration.config.verbose) {
152
+ Logger.verbose(`[Function ${input.functionId}] Building ${handlerCodePath} with options:`, JSON.stringify(options, null, 2));
153
+ }
154
+ else {
155
+ Logger.log(`[Function ${input.functionId}] Building ${handlerCodePath}`);
156
+ }
152
157
  ctx = await esbuild.context(options);
153
158
  }
154
159
  const result = await ctx.rebuild();
@@ -6,7 +6,7 @@ import { Logger } from "./logger.mjs";
6
6
 
7
7
  Logger.setVerbose(workerData.verbose);
8
8
  Logger.verbose(
9
- `[Function ${workerData.functionId}] [Worker ${workerData.workerId}] Worker started`
9
+ `[Function ${workerData.functionId}] [Worker ${workerData.workerId}] Worker started. File: ${workerData.artifactFile}, Handler: ${workerData.handler}`
10
10
  );
11
11
 
12
12
  parentPort.on("message", async (data) => {
package/dist/vsCode.mjs CHANGED
@@ -22,16 +22,16 @@ async function getVsCodeLaunchConfig(lldConfig) {
22
22
  };
23
23
  const moduleDirname = getModuleDirname();
24
24
  //Logger.log("Module folder", moduleDirname);
25
- const currentFolder = path.resolve();
25
+ const projectDirname = getProjectDirname();
26
26
  //Logger.log("Current folder", currentFolder);
27
- const localFolder = path.join(currentFolder, "node_modules/.bin/lld");
27
+ const localFolder = path.resolve(path.join(projectDirname, "node_modules/.bin/lld"));
28
28
  let runtimeExecutableSet = false;
29
29
  //if installed locally
30
30
  if (moduleDirname.startsWith("/home/")) {
31
31
  Logger.verbose("Lambda Live Debugger is installed locally");
32
32
  // check if file exists
33
33
  try {
34
- //Logger.log("Checking local folder", localFolder);
34
+ Logger.log("Checking local folder for runtimeExecutable setting for VsCode configuration", localFolder);
35
35
  await fs.access(localFolder, fs.constants.F_OK);
36
36
  config.configurations[0].runtimeExecutable = localRuntimeExecutable;
37
37
  runtimeExecutableSet = true;
@@ -46,11 +46,13 @@ async function getVsCodeLaunchConfig(lldConfig) {
46
46
  }
47
47
  if (!runtimeExecutableSet) {
48
48
  Logger.verbose(`Setting absolute path for runtimeExecutable setting for VsCode configuration`);
49
+ const localFolderSubfolder = path.resolve("node_modules/.bin/lld");
49
50
  const globalModule1 = path.join(moduleDirname, "..", "..", ".bin/lld");
50
51
  const globalModule2 = path.join(moduleDirname, "..", "..", "bin/lld");
51
52
  const globalModule3 = path.join(moduleDirname, "..", "..", "..", "..", "bin/lld");
52
53
  const possibleFolders = {
53
54
  [localFolder]: "${workspaceFolder}/node_modules/.bin/lld",
55
+ [localFolderSubfolder]: localFolderSubfolder,
54
56
  [globalModule1]: globalModule1,
55
57
  [globalModule2]: globalModule2,
56
58
  [globalModule3]: globalModule3,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambda-live-debugger",
3
- "version": "0.0.96",
3
+ "version": "0.0.98",
4
4
  "type": "module",
5
5
  "description": "Debug Lambda functions locally like it is running in the cloud",
6
6
  "repository": {