@@ -21,7 +21,7 @@ parentPort.on("message", async (data) => {
2121 const __dirname = path . resolve ( "./x" ) ; // CDK needs this, pure magic
2222 eval ( codeFile ) ;
2323
24- if ( global . lambdas . length === 0 ) {
24+ if ( ! global . lambdas || global . lambdas ? .length === 0 ) {
2525 throw new Error ( "No Lambda functions found in the CDK code" ) ;
2626 }
2727
@@ -33,29 +33,15 @@ parentPort.on("message", async (data) => {
3333 path : lambda . code ?. path ,
3434 } ,
3535 cdkPath : lambda . node . defaultChild . node . path ,
36- bundling : lambda . bundling ,
36+ bundling : {
37+ ...lambda . bundling ,
38+ commandHooks : undefined , // can not be serialized
39+ } ,
3740 } ) ) ;
3841
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 ) ;
4847} ) ;
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