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

fix: Removing awsLayers does not remove layers from a deployed function #735

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/deploy/AWSDeployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export default class AWSDeployer extends BaseDeployer {
this._cfg.arch,
],
LoggingConfig: this._cfg.logFormat ? { Format: this._cfg.logFormat } : undefined,
Layers: this._cfg.layers,
Layers: this._cfg.layers || [],
TracingConfig: this._cfg.tracingMode ? { Mode: this._cfg.tracingMode } : undefined,
};

Expand Down
31 changes: 31 additions & 0 deletions test/aws.deployer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,35 @@ describe('AWS Deployer Test', () => {

assert.strictEqual(aws.functionConfig.Handler, 'custom.handler');
});

// https://github.com/adobe/helix-deploy/issues/734
it('uses empty array for Layers if no awsLayers is configured', async () => {
const cfg = new BaseConfig();
const awsCfg = new AWSConfig();
const builder = new ActionBuilder().withConfig(cfg);
await builder.validate();

const aws = new AWSDeployer(cfg, awsCfg);
assert.deepEqual(aws.functionConfig.Layers, []);
});

it('sets Layers if awsLayers is configured (1)', async () => {
const cfg = new BaseConfig();
const awsCfg = new AWSConfig().withAWSLayers(['my-layer:1']);
const builder = new ActionBuilder().withConfig(cfg);
await builder.validate();

const aws = new AWSDeployer(cfg, awsCfg);
assert.deepEqual(aws.functionConfig.Layers, ['my-layer:1']);
});

it('sets Layers if awsLayers is configured (2)', async () => {
const cfg = new BaseConfig();
const awsCfg = new AWSConfig().withAWSLayers(['my-layer:1', 'my-other-layer:1']);
const builder = new ActionBuilder().withConfig(cfg);
await builder.validate();

const aws = new AWSDeployer(cfg, awsCfg);
assert.deepEqual(aws.functionConfig.Layers, ['my-layer:1', 'my-other-layer:1']);
});
});
Loading