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

cdk migrate: could not be generated because Tags is not a valid property for resource LambdaEventSourceMapping #31987

Open
1 task
mpMelnikov opened this issue Nov 2, 2024 · 7 comments
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. p2 package/tools Related to AWS CDK Tools or CLI toolkit/migrate Related to cdk migrate

Comments

@mpMelnikov
Copy link

mpMelnikov commented Nov 2, 2024

Describe the bug

When I try to generate CDK code for my Lambda using cdk migrate --from-scan most-recent --region eu-south-2 --stack-name ai-news-stack --filter tag-key="project",tag-value="ai-news" --verbose I see the error:

Found 30 resources.
Generating CFN template from scanned resources.
Please wait, template creation in progress. This may take a couple minutes.
[CREATE_IN_PROGRESS] Template Creation in Progress
Template successfully generated!
 ❌  Migrate failed for `ai-news-stack`: AiNewsStackStack could not be generated because Tags is not a valid property for resource LambdaEventSourceMapping00a5458fae72e448b2a44c28858d91c3a0009qGls of type AWS::Lambda::EventSourceMapping
[01:12:11] Reading cached notices from /home/mikhail/.cdk/cache/notices.json
AiNewsStackStack could not be generated because Tags is not a valid property for resource LambdaEventSourceMapping00a5458fae72e448b2a44c28858d91c3a0009qGls of type AWS::Lambda::EventSourceMapping

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

cdk migrate --from-scan most-recent --region eu-south-2 --stack-name ai-news-stack --filter tag-key="project",tag-value="ai-news" --verbose is executed without errors and CDK code is generated.

Current Behavior

When I try to generate CDK code for my Lambda using cdk migrate --from-scan most-recent --region eu-south-2 --stack-name ai-news-stack --filter tag-key="project",tag-value="ai-news" --verbose I see the error:

Found 30 resources.
Generating CFN template from scanned resources.
Please wait, template creation in progress. This may take a couple minutes.
[CREATE_IN_PROGRESS] Template Creation in Progress
Template successfully generated!
 ❌  Migrate failed for `ai-news-stack`: AiNewsStackStack could not be generated because Tags is not a valid property for resource LambdaEventSourceMapping00a5458fae72e448b2a44c28858d91c3a0009qGls of type AWS::Lambda::EventSourceMapping
[01:12:11] Reading cached notices from /home/mikhail/.cdk/cache/notices.json
AiNewsStackStack could not be generated because Tags is not a valid property for resource LambdaEventSourceMapping00a5458fae72e448b2a44c28858d91c3a0009qGls of type AWS::Lambda::EventSourceMapping

Reproduction Steps

  1. Create Lambda with a tag.
  2. cdk init app --language csharp or cdk init app --language javascript
  3. cdk bootstrap aws://000000000000:eu-south-2
  4. cdk migrate --from-scan most-recent --region eu-south-2 --stack-name ai-news-stack --filter tag-key="project",tag-value="ai-news" --verbose

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.165.0 (build 00f70f1)

Framework Version

No response

Node.js Version

v18.18.2

OS

Ubuntu 22.04.5 LTS

Language

.NET

Language Version

6.0.135

Other information

No response

@mpMelnikov mpMelnikov added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 2, 2024
@github-actions github-actions bot added @aws-cdk/aws-lambda Related to AWS Lambda package/tools Related to AWS CDK Tools or CLI labels Nov 2, 2024
@ashishdhingra ashishdhingra self-assigned this Nov 4, 2024
@ashishdhingra ashishdhingra added needs-reproduction This issue needs reproduction. p2 toolkit/migrate Related to cdk migrate and removed needs-triage This issue or PR still needs to be triaged. labels Nov 4, 2024
@ashishdhingra
Copy link
Contributor

Followed below mentioned steps using CDK version 2.165.0 (build 00f70f1):

  • Created Lambda function with tag Key project and Value ai-news in us-east-2 region.
  • Created directory and ran cdk init app --language javascript with the new directory as current directory.
  • Executed cdk migrate --from-scan new --region us-east-2 --stack-name ai-news-stack --filter tag-key="project",tag-value="ai-news" --verbose first since the last scan was old and didn't contain this Lambda function. It failed with an error.
  • Deleted all files from current directory and re-ran cdk init app --language javascript.
  • Executed cdk migrate --from-scan most-recent --region us-east-2 --stack-name ai-news-stack --filter tag-key="project",tag-value="ai-news" --verbose.

Result:
cdk migrate failed with below error:

Using the latest successful scan which is 0 days, 0 hours, and 11 minutes old.
Applying filters to resource scan.
finding related resources.
Found 3 resources.
Generating CFN template from scanned resources.
Please wait, template creation in progress. This may take a couple minutes.
[CREATE_IN_PROGRESS] Template Creation in Progress
Template successfully generated!
 ❌  Migrate failed for `ai-news-stack`: AiNewsStackStack could not be generated because RecursiveLoop is not a valid property for resource LambdaFunction00TestJSFunction00nmcyI of type AWS::Lambda::Function
[11:27:51] Reading cached notices from /Users/ashdhin/.cdk/cache/notices.json
AiNewsStackStack could not be generated because RecursiveLoop is not a valid property for resource LambdaFunction00TestJSFunction00nmcyI of type AWS::Lambda::Function
[11:27:51] Error: AiNewsStackStack could not be generated because RecursiveLoop is not a valid property for resource LambdaFunction00TestJSFunction00nmcyI of type AWS::Lambda::Function
    at generateStack (/opt/homebrew/lib/node_modules/aws-cdk/lib/index.js:520:156222)
    at CdkToolkit.migrate (/opt/homebrew/lib/node_modules/aws-cdk/lib/index.js:523:5125)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async exec4 (/opt/homebrew/lib/node_modules/aws-cdk/lib/index.js:575:56240)

The error is different from the one reported by user though.

Related issue #31696.

@mpMelnikov Thanks for reporting the issue. I got a different error than the one you mentioned. There is an existing issue #31696 for RecursiveLoop is not a valid property error. Please review if you still get the original error and if we could close this issue as duplicate since we already have tracking issue.

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-reproduction This issue needs reproduction. labels Nov 4, 2024
@mpMelnikov
Copy link
Author

Hi @ashishdhingra, thank you for your test! I'll check it again in clean environment by the end of this week.

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Nov 4, 2024
Copy link

github-actions bot commented Nov 7, 2024

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Nov 7, 2024
@mpMelnikov
Copy link
Author

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

I am still here and need more time.

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Nov 7, 2024
@ashishdhingra
Copy link
Contributor

Sure. I will re-add response requested label.

@ashishdhingra ashishdhingra added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 7, 2024
@ashishdhingra ashishdhingra removed their assignment Nov 7, 2024
Copy link

github-actions bot commented Nov 9, 2024

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Nov 9, 2024
@mpMelnikov
Copy link
Author

@mpMelnikov Thanks for reporting the issue. I got a different error than the one you mentioned. There is an existing issue #31696 for RecursiveLoop is not a valid property error. Please review if you still get the original error and if we could close this issue as duplicate since we already have tracking issue.

Thanks, Ashish

I confirm that the error I observe is different from the one seen by Ashish. What have I done to reproduce it again?

  1. Opened AWS Console in a region where I don't have any resources (us-east-2).
  2. Created Lambda with the tag 'test_tag' = '2024_11_10'.
  3. Created SQS queue with the same tag 'test_tag' = '2024_11_10'.
  4. Added SQS trigger to the Lambda.
    image
  5. cdk init app --language csharp
  6. cdk migrate --from-scan new --region us-east-2 --stack-name ai-news-stack --filter tag-key="test_tag",tag-value="2024_11_10" --verbose
  7. I see the error I have shared earlier:
Applying filters to resource scan.
finding related resources.
Found 5 resources.
Generating CFN template from scanned resources.
Please wait, template creation in progress. This may take a couple minutes.
[CREATE_IN_PROGRESS] Template Creation in Progress
Template successfully generated!
 ❌  Migrate failed for `ai-news-stack`: AiNewsStackStack could not be generated because Tags is not a valid property for resource LambdaEventSourceMapping0000a5e5ee989d4414aaa15d88e3f9750900fBpmf of type AWS::Lambda::EventSourceMapping
[21:33:22] Reading cached notices from /home/mikhail/.cdk/cache/notices.json
AiNewsStackStack could not be generated because Tags is not a valid property for resource LambdaEventSourceMapping0000a5e5ee989d4414aaa15d88e3f9750900fBpmf of type AWS::Lambda::EventSourceMapping
[21:33:22] Error: AiNewsStackStack could not be generated because Tags is not a valid property for resource LambdaEventSourceMapping0000a5e5ee989d4414aaa15d88e3f9750900fBpmf of type AWS::Lambda::EventSourceMapping
    at generateStack (/home/mikhail/.nvm/versions/node/v18.18.2/lib/node_modules/aws-cdk/lib/index.js:520:156222)
    at CdkToolkit.migrate (/home/mikhail/.nvm/versions/node/v18.18.2/lib/node_modules/aws-cdk/lib/index.js:523:5125)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async exec4 (/home/mikhail/.nvm/versions/node/v18.18.2/lib/node_modules/aws-cdk/lib/index.js:575:56240)

image

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Nov 11, 2024
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. p2 package/tools Related to AWS CDK Tools or CLI toolkit/migrate Related to cdk migrate
Projects
None yet
Development

No branches or pull requests

2 participants