@@ -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
- }
0 commit comments