Skip to content

Commit d677c18

Browse files
authored
Merge pull request #110 from KennethWKZ/fix-deployment-bucket
fix: check if existing deployment bucket is exist but empty & missing aws sdk v3 - S3 & Lambda commands
2 parents 1834d8f + 3d1ad0f commit d677c18

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

lib/aws/commands.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ const {
100100
RemovePermissionCommand,
101101
ListFunctionsCommand,
102102
ListLayersCommand,
103+
ListLayerVersionsCommand,
104+
DeleteLayerVersionCommand,
103105
} = require('@aws-sdk/client-lambda');
104106

105107
// S3 Commands
@@ -114,6 +116,22 @@ const {
114116
HeadBucketCommand,
115117
GetBucketNotificationConfigurationCommand,
116118
PutBucketNotificationConfigurationCommand,
119+
CreateBucketCommand,
120+
GetBucketEncryptionCommand,
121+
PutBucketEncryptionCommand,
122+
GetBucketVersioningCommand,
123+
GetBucketLoggingCommand,
124+
PutBucketVersioningCommand,
125+
PutBucketLoggingCommand,
126+
GetBucketAccelerateConfigurationCommand,
127+
PutBucketAccelerateConfigurationCommand,
128+
PutBucketPolicyCommand,
129+
GetBucketTaggingCommand,
130+
PutBucketTaggingCommand,
131+
DeleteBucketTaggingCommand,
132+
GetPublicAccessBlockCommand,
133+
PutPublicAccessBlockCommand,
134+
DeletePublicAccessBlockCommand,
117135
} = require('@aws-sdk/client-s3');
118136

119137
// SSM Commands
@@ -218,7 +236,9 @@ const COMMAND_MAP = {
218236
listAliases: ListAliasesCommand,
219237
listFunctions: ListFunctionsCommand,
220238
listLayers: ListLayersCommand,
239+
listLayerVersions: ListLayerVersionsCommand,
221240
getLayerVersion: GetLayerVersionCommand,
241+
deleteLayerVersion: DeleteLayerVersionCommand,
222242
addPermission: AddPermissionCommand,
223243
removePermission: RemovePermissionCommand,
224244
},
@@ -234,6 +254,22 @@ const COMMAND_MAP = {
234254
headBucket: HeadBucketCommand,
235255
getBucketNotificationConfiguration: GetBucketNotificationConfigurationCommand,
236256
putBucketNotificationConfiguration: PutBucketNotificationConfigurationCommand,
257+
createBucket: CreateBucketCommand,
258+
getBucketEncryption: GetBucketEncryptionCommand,
259+
putBucketEncryption: PutBucketEncryptionCommand,
260+
getBucketVersioning: GetBucketVersioningCommand,
261+
getBucketLogging: GetBucketLoggingCommand,
262+
putBucketVersioning: PutBucketVersioningCommand,
263+
putBucketLogging: PutBucketLoggingCommand,
264+
getBucketAccelerateConfiguration: GetBucketAccelerateConfigurationCommand,
265+
putBucketAccelerateConfiguration: PutBucketAccelerateConfigurationCommand,
266+
putBucketPolicy: PutBucketPolicyCommand,
267+
getBucketTagging: GetBucketTaggingCommand,
268+
putBucketTagging: PutBucketTaggingCommand,
269+
deleteBucketTagging: DeleteBucketTaggingCommand,
270+
getPublicAccessBlock: GetPublicAccessBlockCommand,
271+
putPublicAccessBlock: PutPublicAccessBlockCommand,
272+
deletePublicAccessBlock: DeletePublicAccessBlockCommand,
237273
// Note: upload is handled separately as it's not a direct API call
238274
},
239275

lib/plugins/aws/deploy/lib/check-for-changes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ module.exports = {
7070
);
7171
}
7272
})();
73-
const objects = result.Contents.filter(({ Key: key }) =>
73+
const objects = result?.Contents?.filter(({ Key: key }) =>
7474
isDeploymentDirToken(key.split('/')[3])
7575
);
76-
if (!objects.length) return [];
76+
if (!objects?.length) return [];
7777

7878
const ordered = _.orderBy(objects, ['Key'], ['desc']);
7979

0 commit comments

Comments
 (0)