File tree Expand file tree Collapse file tree 2 files changed +0
-31
lines changed
lambda-layer/packages/layer Expand file tree Collapse file tree 2 files changed +0
-31
lines changed Original file line number Diff line number Diff line change 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
313export NODE_OPTIONS=" ${NODE_OPTIONS} --import /opt/init.mjs"
324
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments