File tree 1 file changed +8
-1
lines changed 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
11
11
TestInvocationLogs ,
12
12
invokeFunctionOnce ,
13
13
generateTestUniqueName ,
14
+ getRuntimeKey ,
14
15
} from '@aws-lambda-powertools/testing-utils' ;
15
16
import { TestNodejsFunction } from '@aws-lambda-powertools/testing-utils/resources/lambda' ;
16
17
import {
@@ -47,7 +48,13 @@ describe(`Layers E2E tests`, () => {
47
48
} ,
48
49
} ) ;
49
50
50
- const cases = [ 'CJS' , 'ESM' ] as const ;
51
+ /**
52
+ * Node.js 16.x does not support importing ESM modules from Lambda Layers reliably.
53
+ *
54
+ * The feature is available in Node.js 18.x and later.
55
+ * @see https://aws.amazon.com/blogs/compute/node-js-18-x-runtime-now-available-in-aws-lambda/
56
+ */
57
+ const cases = getRuntimeKey ( ) === 'nodejs16x' ? [ 'CJS' ] : [ 'CJS' , 'ESM' ] ;
51
58
const invocationLogsMap : Map < ( typeof cases ) [ number ] , TestInvocationLogs > =
52
59
new Map ( ) ;
53
60
You can’t perform that action at this time.
0 commit comments