Skip to content

Commit bfdc09a

Browse files
committed
minor changes
1 parent 6e0dfea commit bfdc09a

File tree

2 files changed

+0
-31
lines changed

2 files changed

+0
-31
lines changed

lambda-layer/packages/layer/scripts/otel-instrument

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,4 @@
11
#!/bin/bash
2-
_is_esm_handler() {
3-
# Lambda function root directory
4-
TASK_DIR="/var/task"
5-
6-
# Flag variables to track conditions
7-
local found_mjs=false
8-
local is_module=false
9-
10-
# Check for any files ending with `.mjs`
11-
if ls "$TASK_DIR"/*.mjs &>/dev/null; then
12-
found_mjs=true
13-
fi
14-
15-
# Check if `package.json` exists and if it contains `"type": "module"`
16-
if [ -f "$TASK_DIR/package.json" ]; then
17-
# Check for the `"type": "module"` attribute in `package.json`
18-
if grep -q '"type": *"module"' "$TASK_DIR/package.json"; then
19-
is_module=true
20-
fi
21-
fi
22-
23-
# Return true if both conditions are met
24-
if $found_mjs || $is_module; then
25-
return 0 # 0 in bash means true
26-
else
27-
return 1 # 1 in bash means false
28-
fi
29-
}
302

313
export NODE_OPTIONS="${NODE_OPTIONS} --import /opt/init.mjs"
324

lambda-layer/packages/layer/src/loader.mjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,5 @@ if (_isHandlerAnESModule()) {
8787
to prevent redundant "import-in-the-middle" hook initialization overhead during coldstart
8888
of the CommonJS based user handlers.
8989
*/
90-
console.log("OpenTelemetry loader: ESM handler detected, activating 'import-in-the-middle' hook");
9190
registerLoader();
92-
} else {
93-
console.log("OpenTelemetry loader: CJS handler detected, 'import-in-the-middle' hook won't be activated");
9491
}

0 commit comments

Comments
 (0)