Skip to content

Commit 92516b4

Browse files
authored
Merge pull request #128 from BressOne/bugfix-settings-init
2 parents a70afef + 02411dd commit 92516b4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/apiGatewayCachingPlugin.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ class ApiGatewayCachingPlugin {
4141
}
4242

4343
async updateStage() {
44+
if (!this.settings) {
45+
this.createSettings()
46+
}
47+
4448
this.thereIsARestApi = await restApiExists(this.serverless, this.settings);
4549
if (!this.thereIsARestApi) {
4650
this.serverless.cli.log(`[serverless-api-gateway-caching] No REST API found. Caching settings will not be updated.`);
4751
return;
4852
}
4953

50-
if (!this.settings) {
51-
this.createSettings()
52-
}
53-
5454
return updateStageCacheSettings(this.settings, this.serverless);
5555
}
5656

src/restApiId.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ const outputRestApiIdTo = (serverless) => {
4141
};
4242

4343
const getAlreadyDeployedStack = async (serverless, settings) => {
44-
const stackName = serverless.providers.aws.naming.getStackName(settings.stage);
4544
try {
45+
const stackName = serverless.providers.aws.naming.getStackName(settings.stage);
4646
const stack = await serverless.providers.aws.request('CloudFormation', 'describeStacks', { StackName: stackName },
4747
settings.stage,
4848
settings.region

test/creating-plugin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('Creating plugin', () => {
7373
thereIsARestApi: false,
7474
expectedLogMessage: '[serverless-api-gateway-caching] No REST API found. Caching settings will not be updated.',
7575
expectedToUpdateStageCache: false,
76-
expectedToHaveSettings: false
76+
expectedToHaveSettings: true
7777
},
7878
{
7979
description: 'there is a REST API',

0 commit comments

Comments
 (0)