From 63e6d4a3b8622c5d14a082cc3d9f2eef338c670c Mon Sep 17 00:00:00 2001 From: "mariano.pizarro" Date: Wed, 13 Apr 2022 13:01:58 -0300 Subject: [PATCH] fix: iamInstanceProfile never returning when there's a permission's error --- src/services/iamInstanceProfile/data.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/services/iamInstanceProfile/data.ts b/src/services/iamInstanceProfile/data.ts index b1f5a3c5..4f489e1e 100644 --- a/src/services/iamInstanceProfile/data.ts +++ b/src/services/iamInstanceProfile/data.ts @@ -54,15 +54,19 @@ export const listInstancesProfiles = async ( }) } - const { InstanceProfiles = [], IsTruncated, Marker } = data + if (!isEmpty(data)) { + const { InstanceProfiles = [], IsTruncated, Marker } = data - instanceProfileList.push(...InstanceProfiles) + instanceProfileList.push(...InstanceProfiles) - if (IsTruncated) { - listAllInstanceProfiles(Marker) + if (IsTruncated) { + listAllInstanceProfiles(Marker) + } + + resolve(instanceProfileList) } - resolve(instanceProfileList) + resolve([]) } ) } catch (error) {