Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Python->Using Construct Libraries->Extra Credit bug #676

Closed
Tracked by #1170
awsbenpeterson opened this issue Sep 16, 2022 · 3 comments
Closed
Tracked by #1170

Python->Using Construct Libraries->Extra Credit bug #676

awsbenpeterson opened this issue Sep 16, 2022 · 3 comments
Labels
bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@awsbenpeterson
Copy link

Describe the bug

When running cdk watch the hotswap operation for the ViewHitCounterRendered function created by this construct library does not successfully deploy. However, when I run cdk deploy without the --hotswap flag it is successful.

To be fair I'm not yet sure if this is a hotswap bug or a construct library bug, but in either situation it should be documented in the cdkworkshop unless this is a personal problem for just me.

Expected Behavior

I would expect the cdk deploy --hotswap command to yield the same result as cdk deploy but that is not the case.

Current Behavior

✨ hotswapping resources:
✨ Lambda Function 'cdk-workshop-ViewHitCounterRendered9C783E55-Nix6HHH67xmc'
✨ Lambda Function 'cdk-workshop-ViewHitCounterRendered9C783E55-Nix6HHH67xmc' hotswapped!

❌ cdk-workshop failed: InvalidParameterType: Expected params.Environment.Variables['TABLE_NAME'] to be a string
   at ParamValidator.fail (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-sdk/lib/param_validator.js:50:37)
   at ParamValidator.validateType (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-sdk/lib/param_validator.js:233:10)
   at ParamValidator.validateString (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-sdk/lib/param_validator.js:155:32)
   at ParamValidator.validateScalar (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-sdk/lib/param_validator.js:131:21)
   at ParamValidator.validateMember (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-sdk/lib/param_validator.js:95:21)
   at ParamValidator.validateMap (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-sdk/lib/param_validator.js:118:14)
   at ParamValidator.validateMember (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-sdk/lib/param_validator.js:93:21)
   at ParamValidator.validateStructure (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-sdk/lib/param_validator.js:76:14)
   at ParamValidator.validateMember (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-sdk/lib/param_validator.js:89:21)
   at ParamValidator.validateStructure (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-sdk/lib/param_validator.js:76:14) {
 code: 'InvalidParameterType',
 time: 2022-09-16T15:30:39.374Z
}

❌ Deployment failed: Error: Stack Deployments Failed: InvalidParameterType: Expected params.Environment.Variables['TABLE_NAME'] to be a string
   at deployStacks (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-cdk/lib/deploy.ts:61:11)
   at processTicksAndRejections (node:internal/process/task_queues:96:5)
   at CdkToolkit.deploy (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:312:7)
   at CdkToolkit.invokeDeployFromWatch (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:756:7)
   at deployAndWatch (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:371:7)
   at FSWatcher.<anonymous> (/local/home/benpte/.nvm/versions/node/v16.17.0/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:400:9)

Reproduction Steps

This code snippet from the cdk_workshop_stack.py file as described in the workshop produces the error when running cdk deploy --hotswap and is successful when running cdk deploy

TableViewer(
            self, 'ViewHitCounter',
            title='Hello Hits',
            table=hello_with_counter.table,
            sort_by='-hits'
        )

Possible Solution

No response

Additional Information/Context

I actually found this running cdk watch and then realized it is a hotswap error.

CDK CLI Version

2.41.0 (build 6ad48a3)

Section

No response

Browser

No response

Language

Python

@awsbenpeterson awsbenpeterson added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 16, 2022
@awsbenpeterson
Copy link
Author

awsbenpeterson commented Sep 16, 2022

aws/aws-cdk#20787

It looks like this is a feature request that has since been closed:
"Since Function's environment update is not considered hotswappable, user can never perform a hotswap deployment with this code."

@peterwoodworth
Copy link
Contributor

We can make a note of this limitation in the hotswap section of the workshop, at the bottom of this page. Thanks for reporting!

@peterwoodworth peterwoodworth added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Sep 21, 2022
@indrora indrora mentioned this issue Sep 13, 2023
23 tasks
@kellertk kellertk closed this as completed Aug 1, 2024
Copy link

github-actions bot commented Aug 1, 2024

⚠️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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

No branches or pull requests

3 participants