Closed fl0wo closed 2 months ago
Update
Found a temporary workaround:
const encKey = new Key(stack, id + '_key', {
enableKeyRotation: true,
alias: `alias/${id}_key`,
description: `Key for ${id}`,
enabled: true
});
const sns2sqs = new SnsToSqs(stack, id + '_sns_to_sqs', {
existingTopicObj: topic,
queueProps: {
visibilityTimeout: Duration.minutes(15),
},
encryptionKey: encKey
});
Basically I create the encryptionKey. Am I missing something? I think the issue is the id of the Key.
Thanks for pointing this out - my first thought is this is on us and could be straightforward to fix. Let us dig into it, we'll have an hours/days/weeks level ETA shortly.
Can you doublecheck your CDK and Constructs versions? Solution Constructs v2.54.0 was built on CDK v2.130.0, so it requires CDK 2.130.0 or later and won't install on CDK 2.99.0 project. (could package.json say "^2.99.0" ?)
Hi @biffgaut thanks for the quick reply.
cdk --version
2.124.0 (build 4b6724c)
// package.json
"aws-cdk-lib": "^2.99.0",
"@aws-solutions-constructs/aws-s3-sns": "^2.54.0",
"@aws-solutions-constructs/aws-s3-sqs": "^2.54.0",
"@aws-solutions-constructs/aws-sns-lambda": "^2.54.0",
"@aws-solutions-constructs/aws-sns-sqs": "^2.54.0",
"@aws-solutions-constructs/aws-sqs-lambda": "^2.54.0",
Not sure if that's the reason.
The caret (^) indicates that more recent versions are OK. I'm pretty sure if you look at:
your-project/node_modules/aws-cdk-lib/package.json
that you will find that it has installed 2.130.0 or later
Yeah, my bad forgot to include ^
My aws-cdk-lib version is: 2.135.0
I believe v2.55.0 should address your issue.
(please reopen if the issue is not actually corrected)
I'm using SnsToSqs two times (more than one) with the same SNS (existingTopicObj) and a queueProps with visibilityTimeout 15min.
I also tried playing around with encryptionKeyProps but without luck.
Reproduction Steps
Error Log
Error: There is already a Construct with name 'EncryptionKey' in TradingResourcesStack [TradingResourcesTEST] at Node.addChild (/Users/xx/node_modules/constructs/src/construct.ts:447:13) at new Node (/Users/xx/node_modules/constructs/src/construct.ts:71:17) at new Construct (/Usersxx/node_modules/constructs/src/construct.ts:499:17) at new Resource (/Users/xx/node_modules/aws-cdk-lib/core/lib/resource.js:1:1309) at new KeyBase (/Users/xx/node_modules/aws-cdk-lib/aws-kms/lib/key.js:1:898) at new Key (/Users/flo/xx/node_modules/aws-cdk-lib/aws-kms/lib/key.js:1:7094) at Object.buildEncryptionKey (/Users/flo/xx/node_modules/@aws-solutions-constructs/aws-sns-sqs/node_modules/@aws-solutions-constructs/core/lib/kms-helper.ts:36:10) at new SnsToSqs (/Users/flo/xx/node_modules/@aws-solutions-constructs/aws-sns-sqs/lib/index.ts:137:32)
Environment
This is :bug: Bug Report