It seems there is some fundamental change in NodejsFunction as it no longer behaves in the same way when bundling. Running existing unit tests produces a "Maximum call stack size exceeded" error.
See example project at https://github.com/markusl/cdk-codepipeline-bitbucket-build-result-reporter/runs/1452010511 and https://github.com/markusl/cdk-ecr-image-scan-handler/runs/1452125431
FAIL test/index.test.ts (10.518 s)
✕ Create CodePipelineBitbucketBuildResultReporter (351 ms)
● Create CodePipelineBitbucketBuildResultReporter
RangeError: Maximum call stack size exceeded
at Array.sort (native)
Would expect bundling & tests to work just fine after upgrading.
This is :bug: Bug Report
there is a new bundler, you need to install esbuild
I'm getting the same error when trying to synthesize an app:
$ cdk --app 'ts-node bin/processor.ts' synth
RangeError: Maximum call stack size exceeded
at sortObject (/home/azatoth/Project/myProj/node_modules/@aws-cdk/core/lib/asset-staging.ts:469:20)
at sortObject (/home/azatoth/Project/myProj/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (/home/azatoth/Project/myProj/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (/home/azatoth/Project/myProj/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (/home/azatoth/Project/myProj/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (/home/azatoth/Project/myProj/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (/home/azatoth/Project/myProj/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (/home/azatoth/Project/myProj/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (/home/azatoth/Project/myProj/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (/home/azatoth/Project/myProj/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
Subprocess exited with error 1
I've tried to install esbuild both locally and globally but to no avail.
For reference we are building 13 lambda functions.
there is a new bundler, you need to install
esbuild
There is esbuild included but is something else still needed?
https://github.com/markusl/cdk-codepipeline-bitbucket-build-result-reporter/blob/master/package.json#L41
Same here:
$ npx cdk --app 'ts-node src/main.ts' synth
Bundling asset <snip>/Code/Stage...
Bundling asset <snip>/Code/Stage...
Bundling asset <snip>/Code/Stage...
Bundling asset <snip>/Code/Stage...
Bundling asset <snip>/Code/Stage...
RangeError: Maximum call stack size exceeded
at sortObject (<snip>/node_modules/@aws-cdk/core/lib/asset-staging.ts:469:20)
at sortObject (<snip>/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (<snip>/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (<snip>/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (<snip>/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (<snip>/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (<snip>/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (<snip>/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (<snip>/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
at sortObject (<snip>/node_modules/@aws-cdk/core/lib/asset-staging.ts:475:16)
Subprocess exited with error 1
"esbuild": "^0.8.15" in devDependencies.
Some of the functions seem to build fine, the first one that fails kills the process.
Sorry for this... will be fixed in #11698
@jogold do you have any estimate for releasing a fix for this?
@jogold do you have any estimate for releasing a fix for this?
The fix (#11698) is ready... I'm waiting for a review.
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Why wasn't this included in 1.76.0 ? 😞
@eladb @jogold I can second @matthias-pichler-warrify 's question. This is a regression from 1.74.0, which means we would happily accept a hotfix release that fixes the problem :)
The problem here is that the issue does not make just NodeJsFunction unusable but the whole project.
Unfortunately we are blocked from releasing new versions besides launches like Lambda containers during Re:Invent week.
As soon as re:invent is over we will release this.
@jogold do you have a possible workaround until this is released?
Unfortunately we are blocked from releasing new versions besides launches like Lambda containers during Re:Invent week.
This means that a new version will be released on Friday or Monday?
As a temporary workaround I can suggest to patch the file node_modules/@aws-cdk/aws-lambda-nodejs/lib/function.js with the following https://gist.github.com/jogold/4a3f47286b5f7f187fe90c6b53baccf3
You can do this either manually or with patch-package.
@eladb can you pin this issue maybe?
Done
Unfortunately we are blocked from releasing new versions besides launches like Lambda containers during Re:Invent week.
This means that a new version will be released on Friday or Monday?
Reinvent takes another 2 weeks right?
Most helpful comment
@eladb @jogold I can second @matthias-pichler-warrify 's question. This is a regression from 1.74.0, which means we would happily accept a hotfix release that fixes the problem :)
The problem here is that the issue does not make just
NodeJsFunctionunusable but the whole project.