-
Notifications
You must be signed in to change notification settings - Fork 4.4k
(cli): --hotswap does not detect function env variables changes #16444
Copy link
Copy link
Closed
Labels
bugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortin-progressThis issue is being actively worked on.This issue is being actively worked on.package/toolsRelated to AWS CDK Tools or CLIRelated to AWS CDK Tools or CLI
Description
The 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortin-progressThis issue is being actively worked on.This issue is being actively worked on.package/toolsRelated to AWS CDK Tools or CLIRelated to AWS CDK Tools or CLI