Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada committed Mar 21, 2024
1 parent cb0d994 commit e10f6ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion registry-upload/src/awsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export async function readStackConfiguration(cloudFormationStackName: string): P

export async function uploadFileContent(bucket: string, key: string, localFilePath: string): Promise<void> {
const stream = createReadStream(localFilePath)
console.log(`Uploading file ${localFilePath} to ${bucket}/${key}...`)
await s3Client.putObject({ Bucket: bucket, Key: key, Body: stream })
}

Expand All @@ -65,4 +66,4 @@ export async function invalidateCloudFrontCache(distributionId: string): Promise
const callerReference = Date.now().toString()
const invalidationBatch = { CallerReference: callerReference, Paths: { Quantity: 1, Items: ["/*"] } };
await cloudFrontClient.send(new CreateInvalidationCommand({ DistributionId: distributionId, InvalidationBatch: invalidationBatch }))
}
}
4 changes: 1 addition & 3 deletions registry-upload/src/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function upload(args: CommandLineArgs) {
const config = await readStackConfiguration(EXTENSION_MANAGER_STACK_NAME)
console.log(`Read configuration: bucket ${config.bucketName}, domain: ${config.domainName}`)
if (args.dryRun) {
console.log("Dry run, skipping upload")
console.log("Dry run, skipping upload. Specify --no-dry-run to actually upload.")
return
}
await uploadFiles(args.stage, config.bucketName)
Expand Down Expand Up @@ -67,5 +67,3 @@ async function verifyExtensionEntry(extension: any): Promise<void> {
throw new Error(`URL for extension ${id} is invalid`, { cause: error })
}
}


0 comments on commit e10f6ee

Please sign in to comment.