Skip to content

Commit 29d62d6

Browse files
committed
fix(apigw): get unbound secret ids bug
1 parent 6338631 commit 29d62d6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/baas/apigw/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ class Apigw {
229229
secretIds: uniqSecretIds,
230230
limit: uniqSecretIds.length
231231
})
232+
232233
const existKeysLen = apiKeyStatusSet.length
233234

234235
const ids = []
@@ -262,8 +263,6 @@ class Apigw {
262263
}
263264

264265
async setupApiUsagePlan({ usagePlan }) {
265-
console.log('usagePlan', usagePlan)
266-
267266
const usageInputs = {
268267
usagePlanName: usagePlan.usagePlanName || '',
269268
usagePlanDesc: usagePlan.usagePlanDesc || '',
@@ -308,12 +307,17 @@ class Apigw {
308307
offset
309308
})
310309
if (secretIdList.length < limit) {
311-
return res
310+
return secretIdList
312311
}
313-
return getAllBoundSecrets(res, { limit, offset: offset + secretIdList.length })
312+
const more = await getAllBoundSecrets(secretIdList, {
313+
limit,
314+
offset: offset + secretIdList.length
315+
})
316+
return res.concat(more.secretIdList)
314317
}
315318
const allBoundSecretObjs = await getAllBoundSecrets([], { limit: 100 })
316319
const allBoundSecretIds = allBoundSecretObjs.map((item) => item.secretId)
320+
317321
const unboundSecretIds = secretIds.filter((item) => {
318322
if (allBoundSecretIds.indexOf(item) === -1) {
319323
return true

0 commit comments

Comments
 (0)