Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(aws-lambda-nodejs): can't build with lambda layers #11762

Closed
elthrasher opened this issue Nov 29, 2020 · 3 comments · Fixed by #11698
Closed

(aws-lambda-nodejs): can't build with lambda layers #11762

elthrasher opened this issue Nov 29, 2020 · 3 comments · Fixed by #11698
Assignees
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@elthrasher
Copy link
Contributor

The NodejsFunction fails with the following error when attempting to build with a lambda layer.

$ cdk synth
Converting circular structure to JSON
    --> starting at object with constructor 'LayerVersion'
    |     property 'node' -> object with constructor 'ConstructNode'
    --- property 'host' closes the circle
Subprocess exited with error 1
error Command failed with exit code 1.

Reproduction Steps

I created a repo to demonstrate the error here: https://github.com/elthrasher/circular-layer
Should be reproducible with any NodejsFunction + layer combo. Instructions in the README.

What did you expect to happen?

Add a lambda layer to a NodejsFunction construct.

What actually happened?

Got the error above.

Environment

  • CDK CLI Version: 1.75.0
  • Node.js Version: 12.19.1
  • OS: macOS Catalina
  • Language (Version): TypeScript (all)

Other

There is a workaround available (see https://github.com/elthrasher/circular-layer).


This is 🐛 Bug Report

@elthrasher elthrasher added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 29, 2020
@elthrasher
Copy link
Contributor Author

Just thought to check earlier versions and I see the same issue prior to cdk 1.75.0 so I don't think it was introduced with esbuild.

@jogold
Copy link
Contributor

jogold commented Nov 29, 2020

#11698

@mergify mergify bot closed this as completed in #11698 Nov 29, 2020
mergify bot pushed a commit that referenced this issue Nov 29, 2020
…rcular structure to JSON (#11698)

All the `FunctionOptions` were leaking into `core` where a cache key is
calculated in asset staging. Some of those options have circular references
making it impossible to calculate a cache key with the current implementation.

Another PR is needed to make the cache key calculation in `core` more
robust.

Closes #11693 
Closes #11726
Closes #11762

BREAKING CHANGE: bundling customization options like `minify` or `sourceMap` are now gathered under a new `bundling` prop.
* **lambda-nodejs**: `bundlingEnvironment` is now `bundling.environment`
* **lambda-nodejs**: `bundlingDockerImage` is now `bundling.dockerImage`

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
3 participants