Skip to content

Commit a5999f1

Browse files
fix: Use NODE_OPTIONS=--enable-source-maps only localy
1 parent f6d5831 commit a5999f1

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

src/infraDeploy.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -559,19 +559,9 @@ function getEnvironmentVarablesForDebugger(
559559
functionId: string,
560560
timeout: number | undefined,
561561
): Record<string, string> {
562-
const baseNodeOptions = '--enable-source-maps';
563-
const additionalNodeOptions =
564-
Configuration.config.additionalNodeOptions || '';
565-
const nodeOptions = [baseNodeOptions, additionalNodeOptions]
566-
.filter(Boolean)
567-
.join(' ');
568-
569-
console.log('nodeOptions', nodeOptions);
570-
571562
return {
572563
LLD_FUNCTION_ID: functionId,
573564
AWS_LAMBDA_EXEC_WRAPPER: '/opt/lld-wrapper',
574-
NODE_OPTIONS: nodeOptions,
575565
LLD_DEBUGGER_ID: Configuration.config.debuggerId,
576566
LLD_INITIAL_TIMEOUT: timeout ? timeout.toString() : '-1', // should never be negative
577567
LLD_OBSERVABLE_MODE: Configuration.config.observable ? 'true' : 'false',

src/nodeWorker.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ async function runInWorker(input: {
3434
);
3535

3636
if (!worker) {
37+
const environment = input.environment;
38+
addEnableSourceMapsToEnv(environment);
39+
3740
worker = startWorker({
3841
handler: func.handler ?? 'handler',
3942
artifactFile: input.artifactFile,
4043
workerId: input.fuctionRequest.workerId,
4144
functionId: input.fuctionRequest.functionId,
42-
environment: input.environment,
45+
environment,
4346
verbose: Configuration.config.verbose,
4447
});
4548
worker.used = false;
@@ -85,6 +88,20 @@ async function runInWorker(input: {
8588
});
8689
}
8790

91+
/**
92+
* Add NODE_OPTIONS: --enable-source-maps to the environment variables
93+
* @param environment
94+
*/
95+
function addEnableSourceMapsToEnv(environment: {
96+
[key: string]: string | undefined;
97+
}) {
98+
const nodeOptions = environment.NODE_OPTIONS || '';
99+
if (!nodeOptions.includes('--enable-source-maps')) {
100+
environment.NODE_OPTIONS =
101+
nodeOptions + (nodeOptions ? ' ' : '') + '--enable-source-maps';
102+
}
103+
}
104+
88105
type WorkerRequest = {
89106
handler: string;
90107
artifactFile: string;

src/types/lldConfig.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ export type LldConfigBase = {
6868
* Monorepo subfolder
6969
*/
7070
subfolder?: string;
71-
72-
/**
73-
* Additional Node options
74-
*/
75-
additionalNodeOptions?: string;
7671
} & AwsConfiguration;
7772

7873
export type LldConfigCliArgs = {

test/utils/expectInfraDeployed.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export async function expectInfraDeployed(lambdaName: any) {
1515
LLD_DEBUGGER_ID: expect.any(String),
1616
LLD_FUNCTION_ID: expect.any(String),
1717
LLD_INITIAL_TIMEOUT: expect.any(String),
18-
NODE_OPTIONS: '--enable-source-maps',
1918
});
2019

2120
const initialTimeout = parseInt(

0 commit comments

Comments
 (0)