Skip to content

Commit

Permalink
Merge c36f73a into 14cedd2
Browse files Browse the repository at this point in the history
  • Loading branch information
icholy committed Jan 17, 2023
2 parents 14cedd2 + c36f73a commit 1b44fa5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/config.js
Expand Up @@ -167,7 +167,7 @@ function getConfigsByWarmer({ service, classes }, stage) {
concurrency: 1,
};

const configsByWarmer = Object.entries(service.custom ? service.custom.warmup : {})
const configsByWarmer = Object.entries((service.custom && service.custom.warmup) || {})
.reduce((warmers, [warmerName, warmerConfig]) => ({
...warmers,
[warmerName]: {
Expand Down
14 changes: 14 additions & 0 deletions test/hook.warmupAddWamersAddWamers.test.js
Expand Up @@ -2147,6 +2147,20 @@ describe('Serverless warmup plugin warmup:warmers:addWarmers:addWarmers hook', (
}
});

it('Should not error if the warmup configuration is missing', async () => {
const serverless = getServerlessConfig({
service: {
custom: {},
functions: {},
},
});
const pluginUtils = getPluginUtils();
const plugin = new WarmUp(serverless, {}, pluginUtils);

await plugin.hooks['before:warmup:addWarmers:addWarmers']();
await plugin.hooks['warmup:addWarmers:addWarmers']();
});

describe('Packaging', () => {
it('Should package only the lambda handler by default', async () => {
const serverless = getServerlessConfig({
Expand Down

0 comments on commit 1b44fa5

Please sign in to comment.