Skip to content

Commit bc151da

Browse files
author
diana.ionita
committed
Merge branch 'release/1.1.1'
2 parents 8f87147 + e7b321d commit bc151da

File tree

7 files changed

+86
-321
lines changed

7 files changed

+86
-321
lines changed

package-lock.json

Lines changed: 1 addition & 218 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "serverless-api-gateway-caching",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "A plugin for the serverless framework which helps with configuring caching for API Gateway endpoints.",
55
"main": "src/apiGatewayCachingPlugin.js",
66
"scripts": {
@@ -18,7 +18,6 @@
1818
"author": "Diana Ionita",
1919
"license": "ISC",
2020
"dependencies": {
21-
"aws-sdk": "^2.310.0",
2221
"lodash.get": "^4.4.2",
2322
"lodash.isempty": "^4.4.0"
2423
},
@@ -30,7 +29,6 @@
3029
"url": "https://github.com/DianaIonita/serverless-api-gateway-caching"
3130
},
3231
"devDependencies": {
33-
"aws-sdk-mock": "^4.1.0",
3432
"chai": "^4.1.2",
3533
"chance": "^1.0.16",
3634
"mocha": "^5.2.0",

src/stageCache.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const isEmpty = require('lodash.isempty');
2-
const AWS = require('aws-sdk');
32

43
const getRestApiId = async (settings, serverless) => {
54
const stackName = serverless.providers.aws.naming.getStackName(settings.stage);
@@ -122,10 +121,6 @@ const updateStageCacheSettings = async (settings, serverless) => {
122121

123122
let restApiId = await getRestApiId(settings, serverless);
124123

125-
AWS.config.update({
126-
region: settings.region,
127-
});
128-
129124
let patchOps = createPatchForStage(settings);
130125

131126
let endpointsWithCachingEnabled = settings.endpointSettings.filter(e => e.cachingEnabled);
@@ -137,15 +132,14 @@ const updateStageCacheSettings = async (settings, serverless) => {
137132
let endpointPatch = createPatchForEndpoint(endpointSettings, serverless);
138133
patchOps = patchOps.concat(endpointPatch);
139134
}
140-
const apiGateway = new AWS.APIGateway();
141135
let params = {
142136
restApiId,
143137
stageName: settings.stage,
144138
patchOperations: patchOps
145139
}
146140

147141
serverless.cli.log(`[serverless-api-gateway-caching] Updating API Gateway cache settings.`);
148-
await apiGateway.updateStage(params).promise();
142+
await serverless.providers.aws.request('APIGateway', 'updateStage', params, settings.stage, settings.region);
149143
serverless.cli.log(`[serverless-api-gateway-caching] Done updating API Gateway cache settings.`);
150144
}
151145

0 commit comments

Comments
 (0)