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

(lambda): adding events in constructor causes circular json #11726

Closed
nicolaracco opened this issue Nov 26, 2020 · 1 comment · Fixed by #11698
Closed

(lambda): adding events in constructor causes circular json #11726

nicolaracco opened this issue Nov 26, 2020 · 1 comment · Fixed by #11698
Assignees
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@nicolaracco
Copy link
Contributor

When creating a lambda function, if the event sources are added in the constructor of the function cdk raises a circular json error.

Reproduction Steps

const myQueue= new sqs.Queue(this, 'Queue', {
  queueName: 'financesUnorderTransactionsSqs',
});
const myLambda = new lambda.NodejsFunction(this, 'ConsumerUnorderTransactionFn', {
  entry: 'my-handler.ts',
  events: [new SqsEventSource(myQueue)],
});

What actually happened?

When running npx cdk list this is the output:

Converting circular structure to JSON
    --> starting at object with constructor 'Queue'
    |     property 'node' -> object with constructor 'ConstructNode'
    --- property 'host' closes the circle
Subprocess exited with error 1

Environment

  • CDK CLI Version : 1.75
  • Framework Version: 1.75
  • Node.js Version: 14.8.0
  • OS : Ubuntu Linux
  • Language (Version): TypeScript 3.9.7

This is 🐛 Bug Report

@nicolaracco nicolaracco added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 26, 2020
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Nov 26, 2020
@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 Related to AWS Lambda bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
2 participants