mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
fix(AWS API Gateway): Fix handling of usagePlan array
Improves leaky logic introduces with https://github.com/serverless/serverless/pull/5982 Exposed by regression introduced with https://github.com/serverless/serverless/pull/7827
This commit is contained in:
parent
5d165ba2db
commit
85cc4476b3
@ -50,8 +50,9 @@ module.exports = {
|
||||
const name = Object.keys(apiKeyDefinition)[0];
|
||||
if (
|
||||
_.isObject(apiKeyDefinition) &&
|
||||
Array.isArray(this.serverless.service.provider.usagePlan) &&
|
||||
_.flatten(
|
||||
(this.serverless.service.provider.usagePlan || []).map(item => Object.keys(item))
|
||||
this.serverless.service.provider.usagePlan.map(item => Object.keys(item))
|
||||
).includes(name)
|
||||
) {
|
||||
keyNumber = 0;
|
||||
|
||||
@ -39,6 +39,11 @@ describe('#compileApiKeys()', () => {
|
||||
},
|
||||
];
|
||||
|
||||
// Added purely to test https://github.com/serverless/serverless/issues/7844 regression
|
||||
awsCompileApigEvents.serverless.service.provider.usagePlan = {
|
||||
quota: { limit: 5000 },
|
||||
};
|
||||
|
||||
return awsCompileApigEvents.compileApiKeys().then(() => {
|
||||
const expectedApiKeys = [
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user