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 call on non-init settings object #128

Merged
merged 1 commit into from
Aug 2, 2023
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
8 changes: 4 additions & 4 deletions src/apiGatewayCachingPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ class ApiGatewayCachingPlugin {
}

async updateStage() {
if (!this.settings) {
this.createSettings()
}

this.thereIsARestApi = await restApiExists(this.serverless, this.settings);
if (!this.thereIsARestApi) {
this.serverless.cli.log(`[serverless-api-gateway-caching] No REST API found. Caching settings will not be updated.`);
return;
}

if (!this.settings) {
this.createSettings()
}

return updateStageCacheSettings(this.settings, this.serverless);
}

Expand Down
2 changes: 1 addition & 1 deletion src/restApiId.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const outputRestApiIdTo = (serverless) => {
};

const getAlreadyDeployedStack = async (serverless, settings) => {
const stackName = serverless.providers.aws.naming.getStackName(settings.stage);
try {
const stackName = serverless.providers.aws.naming.getStackName(settings.stage);
const stack = await serverless.providers.aws.request('CloudFormation', 'describeStacks', { StackName: stackName },
settings.stage,
settings.region
Expand Down
2 changes: 1 addition & 1 deletion test/creating-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('Creating plugin', () => {
thereIsARestApi: false,
expectedLogMessage: '[serverless-api-gateway-caching] No REST API found. Caching settings will not be updated.',
expectedToUpdateStageCache: false,
expectedToHaveSettings: false
expectedToHaveSettings: true
},
{
description: 'there is a REST API',
Expand Down