(cli): `--hotswap` does not detect function env variables changes
See original GitHub issueThe new hot-swap feature doesn’t detect function prop changes like environment variables.
Reproduction Steps
app.ts
export class BugStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props: cdk.StackProps = {}) {
super(scope, id, props);
const dateString = new Date().toISOString();
new lambda.Function(this, 'Function', {
runtime: lambda.Runtime.NODEJS_14_X,
code: lambda.Code.fromAsset(__dirname),
handler: 'bug-handler.handler',
environment: {
ENV_VARS_LAST_UPDATE: dateString,
},
});
}
}
const app = new cdk.App();
new BugStack(app, 'BugStack');
bug-handler.js
exports.handler = async () => process.env.ENV_VARS_LAST_UPDATE || 'unset';
What did you expect to happen?
I expected cdk deploy BugStack --hotswap
to deploy the stack every time I ran it.
What actually happened?
It said (no changes)
on the second deployment, failing to update the environment variable.
Environment
- CDK CLI Version : 1.122.0
- Framework Version: 1.122.0
- Node.js Version: v14.15.4
- OS : Windows
- Language (Version): TypeScript (4.4.2)
Other
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Hot Swapping - LocalStack Docs
This way you can easily import modules from your virtualenv, without having to change the file system layout. Note: As an alternative to...
Read more >AWS CDK Toolkit (cdk command) - AWS Documentation
Use the --hotswap flag with cdk deploy to attempt to update your AWS resources directly instead of generating an AWS CloudFormation changeset and...
Read more >Using HotswapAgent to Speed up Development - Blog | Payara
In this post, I'm going to write up how I got the HotswapAgent running in my IDE and Payara Server.
Read more >Azure Functions deployment slots | Microsoft Learn
With a function app that is running under an App Service plan, you can change the underlying App Service plan for a slot....
Read more >AWS CDK Toolkit - npm
If the tool detects that the change does not support hotswapping, it will fall back and perform a full CloudFormation deployment, exactly like ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, this definitely looks like a bug in the
diff
command (which hotswap uses, like you correctly guessed).Thanks @misterjoshua!
If I could ask for one more thing 🙂. Before running
cdk deploy --hotswap
, can you runcdk diff
, and show me the output of that command?