@devtion/backend 0.0.0-3c7b092 → 0.0.0-3df1645

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,6 +58,7 @@ import {
58
58
  uploadFileToBucket
59
59
  } from "../lib/utils"
60
60
  import { EC2Client } from "@aws-sdk/client-ec2"
61
+ import { HttpsError } from "firebase-functions/v2/https"
61
62
 
62
63
  dotenv.config()
63
64
 
@@ -214,57 +215,80 @@ const coordinate = async (
214
215
  * Wait until the command has completed its execution inside the VM.
215
216
  * @dev this method implements a custom interval to check 5 times after 1 minute if the command execution
216
217
  * has been completed or not by calling the `retrieveCommandStatus` method.
217
- * @param {any} resolve the promise.
218
- * @param {any} reject the promise.
219
218
  * @param {SSMClient} ssm the SSM client.
220
219
  * @param {string} vmInstanceId the unique identifier of the VM instance.
221
220
  * @param {string} commandId the unique identifier of the VM command.
222
221
  * @returns <Promise<void>> true when the command execution succeed; otherwise false.
223
222
  */
224
- const waitForVMCommandExecution = (
225
- resolve: any,
226
- reject: any,
227
- ssm: SSMClient,
228
- vmInstanceId: string,
229
- commandId: string
230
- ) => {
231
- const interval = setInterval(async () => {
232
- try {
233
- // Get command status.
234
- const cmdStatus = await retrieveCommandStatus(ssm, vmInstanceId, commandId)
235
- printLog(`Checking command ${commandId} status => ${cmdStatus}`, LogLevel.DEBUG)
236
-
237
- if (cmdStatus === CommandInvocationStatus.SUCCESS) {
238
- printLog(`Command ${commandId} successfully completed`, LogLevel.DEBUG)
239
-
240
- // Resolve the promise.
241
- resolve()
242
- } else if (cmdStatus === CommandInvocationStatus.FAILED) {
243
- logAndThrowError(SPECIFIC_ERRORS.SE_VM_FAILED_COMMAND_EXECUTION)
244
- reject()
245
- } else if (cmdStatus === CommandInvocationStatus.TIMED_OUT) {
246
- logAndThrowError(SPECIFIC_ERRORS.SE_VM_TIMEDOUT_COMMAND_EXECUTION)
247
- reject()
248
- } else if (cmdStatus === CommandInvocationStatus.CANCELLED) {
249
- logAndThrowError(SPECIFIC_ERRORS.SE_VM_CANCELLED_COMMAND_EXECUTION)
250
- reject()
251
- } else if (cmdStatus === CommandInvocationStatus.DELAYED) {
252
- logAndThrowError(SPECIFIC_ERRORS.SE_VM_DELAYED_COMMAND_EXECUTION)
253
- reject()
254
- }
255
- } catch (error: any) {
256
- printLog(`Invalid command ${commandId} execution`, LogLevel.DEBUG)
223
+ const waitForVMCommandExecution = (ssm: SSMClient, vmInstanceId: string, commandId: string): Promise<void> =>
224
+ new Promise((resolve, reject) => {
225
+ const poll = async () => {
226
+ try {
227
+ // Get command status.
228
+ const cmdStatus = await retrieveCommandStatus(ssm, vmInstanceId, commandId)
229
+ printLog(`Checking command ${commandId} status => ${cmdStatus}`, LogLevel.DEBUG)
230
+
231
+ let error: HttpsError | undefined
232
+ switch (cmdStatus) {
233
+ case CommandInvocationStatus.CANCELLING:
234
+ case CommandInvocationStatus.CANCELLED: {
235
+ error = SPECIFIC_ERRORS.SE_VM_CANCELLED_COMMAND_EXECUTION
236
+ break
237
+ }
238
+ case CommandInvocationStatus.DELAYED: {
239
+ error = SPECIFIC_ERRORS.SE_VM_DELAYED_COMMAND_EXECUTION
240
+ break
241
+ }
242
+ case CommandInvocationStatus.FAILED: {
243
+ error = SPECIFIC_ERRORS.SE_VM_FAILED_COMMAND_EXECUTION
244
+ break
245
+ }
246
+ case CommandInvocationStatus.TIMED_OUT: {
247
+ error = SPECIFIC_ERRORS.SE_VM_TIMEDOUT_COMMAND_EXECUTION
248
+ break
249
+ }
250
+ case CommandInvocationStatus.IN_PROGRESS:
251
+ case CommandInvocationStatus.PENDING: {
252
+ // wait a minute and poll again
253
+ setTimeout(poll, 60000)
254
+ return
255
+ }
256
+ case CommandInvocationStatus.SUCCESS: {
257
+ printLog(`Command ${commandId} successfully completed`, LogLevel.DEBUG)
258
+
259
+ // Resolve the promise.
260
+ resolve()
261
+ return
262
+ }
263
+ default: {
264
+ logAndThrowError(SPECIFIC_ERRORS.SE_VM_UNKNOWN_COMMAND_STATUS)
265
+ }
266
+ }
267
+
268
+ if (error) {
269
+ logAndThrowError(error)
270
+ }
271
+ } catch (error: any) {
272
+ printLog(`Invalid command ${commandId} execution`, LogLevel.DEBUG)
273
+
274
+ const ec2 = await createEC2Client()
257
275
 
258
- if (!error.toString().includes(commandId)) logAndThrowError(COMMON_ERRORS.CM_INVALID_COMMAND_EXECUTION)
276
+ // if it errors out, let's just log it as a warning so the coordinator is aware
277
+ try {
278
+ await stopEC2Instance(ec2, vmInstanceId)
279
+ } catch (error: any) {
280
+ printLog(`Error while stopping VM instance ${vmInstanceId} - Error ${error}`, LogLevel.WARN)
281
+ }
259
282
 
260
- // Reject the promise.
261
- reject()
262
- } finally {
263
- // Clear the interval.
264
- clearInterval(interval)
283
+ if (!error.toString().includes(commandId)) logAndThrowError(COMMON_ERRORS.CM_INVALID_COMMAND_EXECUTION)
284
+
285
+ // Reject the promise.
286
+ reject()
287
+ }
265
288
  }
266
- }, 60000) // 1 minute.
267
- }
289
+
290
+ setTimeout(poll, 60000)
291
+ })
268
292
 
269
293
  /**
270
294
  * This method is used to coordinate the waiting queues of ceremony circuits.
@@ -286,7 +310,7 @@ const waitForVMCommandExecution = (
286
310
  * - Just completed a contribution or all contributions for each circuit. If yes, coordinate (multi-participant scenario).
287
311
  */
288
312
  export const coordinateCeremonyParticipant = functionsV1
289
- .region('europe-west1')
313
+ .region("europe-west1")
290
314
  .runWith({
291
315
  memory: "512MB"
292
316
  })
@@ -387,7 +411,6 @@ export const coordinateCeremonyParticipant = functionsV1
387
411
  }
388
412
  })
389
413
 
390
-
391
414
  /**
392
415
  * Recursive function to check whether an EC2 is in a running state
393
416
  * @notice required step to run commands
@@ -396,16 +419,12 @@ export const coordinateCeremonyParticipant = functionsV1
396
419
  * @param attempts <number> - how many times to retry before failing
397
420
  * @returns <Promise<boolean>> - whether the VM was started
398
421
  */
399
- const checkIfVMRunning = async (
400
- ec2: EC2Client,
401
- vmInstanceId: string,
402
- attempts = 5
403
- ): Promise<boolean> => {
422
+ const checkIfVMRunning = async (ec2: EC2Client, vmInstanceId: string, attempts = 5): Promise<boolean> => {
404
423
  // if we tried 5 times, then throw an error
405
424
  if (attempts <= 0) logAndThrowError(SPECIFIC_ERRORS.SE_VM_NOT_RUNNING)
406
425
 
407
- await sleep(60000); // Wait for 1 min
408
- const isVMRunning = await checkIfRunning(ec2, vmInstanceId)
426
+ await sleep(60000) // Wait for 1 min
427
+ const isVMRunning = await checkIfRunning(ec2, vmInstanceId)
409
428
 
410
429
  if (!isVMRunning) {
411
430
  printLog(`VM not running, ${attempts - 1} attempts remaining. Retrying in 1 minute...`, LogLevel.DEBUG)
@@ -442,7 +461,7 @@ const checkIfVMRunning = async (
442
461
  * 2) Send all updates atomically to the Firestore database.
443
462
  */
444
463
  export const verifycontribution = functionsV2.https.onCall(
445
- { memory: "16GiB", timeoutSeconds: 3600, region: 'europe-west1' },
464
+ { memory: "16GiB", timeoutSeconds: 3600, region: "europe-west1" },
446
465
  async (request: functionsV2.https.CallableRequest<VerifyContributionData>): Promise<any> => {
447
466
  if (!request.auth || (!request.auth.token.participant && !request.auth.token.coordinator))
448
467
  logAndThrowError(SPECIFIC_ERRORS.SE_AUTH_NO_CURRENT_AUTH_USER)
@@ -610,7 +629,6 @@ export const verifycontribution = functionsV2.https.onCall(
610
629
  verificationTranscriptTemporaryLocalPath,
611
630
  true
612
631
  )
613
-
614
632
  } else {
615
633
  // Upload verification transcript.
616
634
  /// nb. do not use multi-part upload here due to small file size.
@@ -688,8 +706,16 @@ export const verifycontribution = functionsV2.https.onCall(
688
706
  }
689
707
 
690
708
  // Stop VM instance
691
- if (isUsingVM) await stopEC2Instance(ec2, vmInstanceId)
692
-
709
+ if (isUsingVM) {
710
+ // using try and catch as the VM stopping function can throw
711
+ // however we want to continue without stopping as the
712
+ // verification was valid, and inform the coordinator
713
+ try {
714
+ await stopEC2Instance(ec2, vmInstanceId)
715
+ } catch (error: any) {
716
+ printLog(`Error while stopping VM instance ${vmInstanceId} - Error ${error}`, LogLevel.WARN)
717
+ }
718
+ }
693
719
  // Step (1.A.4.C)
694
720
  if (!isFinalizing) {
695
721
  // Step (1.A.4.C.1)
@@ -709,7 +735,7 @@ export const verifycontribution = functionsV2.https.onCall(
709
735
  ? (avgVerifyCloudFunctionTime + verifyCloudFunctionTime) / 2
710
736
  : verifyCloudFunctionTime
711
737
 
712
- // Prepare tx to update circuit average contribution/verification time.
738
+ // Prepare tx to update circuit average contribution/verification time.
713
739
  const updatedCircuitDoc = await getDocumentById(getCircuitsCollectionPath(ceremonyId), circuitId)
714
740
  const { waitingQueue: updatedWaitingQueue } = updatedCircuitDoc.data()!
715
741
  /// @dev this must happen only for valid contributions.
@@ -783,9 +809,7 @@ export const verifycontribution = functionsV2.https.onCall(
783
809
  printLog(`Starting the execution of command ${commandId}`, LogLevel.DEBUG)
784
810
 
785
811
  // Step (1.A.3.3).
786
- return new Promise<void>((resolve, reject) =>
787
- waitForVMCommandExecution(resolve, reject, ssm, vmInstanceId, commandId)
788
- )
812
+ return waitForVMCommandExecution(ssm, vmInstanceId, commandId)
789
813
  .then(async () => {
790
814
  // Command execution successfully completed.
791
815
  printLog(`Command ${commandId} execution has been successfully completed`, LogLevel.DEBUG)
@@ -797,59 +821,57 @@ export const verifycontribution = functionsV2.https.onCall(
797
821
 
798
822
  logAndThrowError(COMMON_ERRORS.CM_INVALID_COMMAND_EXECUTION)
799
823
  })
800
- } else {
801
- // CF approach.
802
- printLog(`CF mechanism`, LogLevel.DEBUG)
824
+ }
803
825
 
804
- const potStoragePath = getPotStorageFilePath(files.potFilename)
805
- const firstZkeyStoragePath = getZkeyStorageFilePath(prefix, `${prefix}_${genesisZkeyIndex}.zkey`)
806
- // Prepare temporary file paths.
807
- // (nb. these are needed to download the necessary artifacts for verification from AWS S3).
808
- verificationTranscriptTemporaryLocalPath = createTemporaryLocalPath(
809
- verificationTranscriptCompleteFilename
810
- )
811
- const potTempFilePath = createTemporaryLocalPath(`${circuitId}_${participantDoc.id}.pot`)
812
- const firstZkeyTempFilePath = createTemporaryLocalPath(`${circuitId}_${participantDoc.id}_genesis.zkey`)
813
- const lastZkeyTempFilePath = createTemporaryLocalPath(`${circuitId}_${participantDoc.id}_last.zkey`)
814
-
815
- // Create and populate transcript.
816
- const transcriptLogger = createCustomLoggerForFile(verificationTranscriptTemporaryLocalPath)
817
- transcriptLogger.info(
818
- `${
819
- isFinalizing ? `Final verification` : `Verification`
820
- } transcript for ${prefix} circuit Phase 2 contribution.\n${
821
- isFinalizing ? `Coordinator ` : `Contributor # ${Number(lastZkeyIndex)}`
822
- } (${contributorOrCoordinatorIdentifier})\n`
823
- )
826
+ // CF approach.
827
+ printLog(`CF mechanism`, LogLevel.DEBUG)
828
+
829
+ const potStoragePath = getPotStorageFilePath(files.potFilename)
830
+ const firstZkeyStoragePath = getZkeyStorageFilePath(prefix, `${prefix}_${genesisZkeyIndex}.zkey`)
831
+ // Prepare temporary file paths.
832
+ // (nb. these are needed to download the necessary artifacts for verification from AWS S3).
833
+ verificationTranscriptTemporaryLocalPath = createTemporaryLocalPath(verificationTranscriptCompleteFilename)
834
+ const potTempFilePath = createTemporaryLocalPath(`${circuitId}_${participantDoc.id}.pot`)
835
+ const firstZkeyTempFilePath = createTemporaryLocalPath(`${circuitId}_${participantDoc.id}_genesis.zkey`)
836
+ const lastZkeyTempFilePath = createTemporaryLocalPath(`${circuitId}_${participantDoc.id}_last.zkey`)
837
+
838
+ // Create and populate transcript.
839
+ const transcriptLogger = createCustomLoggerForFile(verificationTranscriptTemporaryLocalPath)
840
+ transcriptLogger.info(
841
+ `${
842
+ isFinalizing ? `Final verification` : `Verification`
843
+ } transcript for ${prefix} circuit Phase 2 contribution.\n${
844
+ isFinalizing ? `Coordinator ` : `Contributor # ${Number(lastZkeyIndex)}`
845
+ } (${contributorOrCoordinatorIdentifier})\n`
846
+ )
824
847
 
825
- // Step (1.A.2).
826
- await downloadArtifactFromS3Bucket(bucketName, potStoragePath, potTempFilePath)
827
- await downloadArtifactFromS3Bucket(bucketName, firstZkeyStoragePath, firstZkeyTempFilePath)
828
- await downloadArtifactFromS3Bucket(bucketName, lastZkeyStoragePath, lastZkeyTempFilePath)
829
-
830
- // Step (1.A.4).
831
- isContributionValid = await zKey.verifyFromInit(
832
- firstZkeyTempFilePath,
833
- potTempFilePath,
834
- lastZkeyTempFilePath,
835
- transcriptLogger
836
- )
837
-
838
- // Compute contribution hash.
839
- lastZkeyBlake2bHash = await blake512FromPath(lastZkeyTempFilePath)
848
+ // Step (1.A.2).
849
+ await downloadArtifactFromS3Bucket(bucketName, potStoragePath, potTempFilePath)
850
+ await downloadArtifactFromS3Bucket(bucketName, firstZkeyStoragePath, firstZkeyTempFilePath)
851
+ await downloadArtifactFromS3Bucket(bucketName, lastZkeyStoragePath, lastZkeyTempFilePath)
840
852
 
841
- // Free resources by unlinking temporary folders.
842
- // Do not free-up verification transcript path here.
843
- try {
844
- fs.unlinkSync(potTempFilePath)
845
- fs.unlinkSync(firstZkeyTempFilePath)
846
- fs.unlinkSync(lastZkeyTempFilePath)
847
- } catch (error: any) {
848
- printLog(`Error while unlinking temporary files - Error ${error}`, LogLevel.WARN)
849
- }
853
+ // Step (1.A.4).
854
+ isContributionValid = await zKey.verifyFromInit(
855
+ firstZkeyTempFilePath,
856
+ potTempFilePath,
857
+ lastZkeyTempFilePath,
858
+ transcriptLogger
859
+ )
850
860
 
851
- await completeVerification()
861
+ // Compute contribution hash.
862
+ lastZkeyBlake2bHash = await blake512FromPath(lastZkeyTempFilePath)
863
+
864
+ // Free resources by unlinking temporary folders.
865
+ // Do not free-up verification transcript path here.
866
+ try {
867
+ fs.unlinkSync(potTempFilePath)
868
+ fs.unlinkSync(firstZkeyTempFilePath)
869
+ fs.unlinkSync(lastZkeyTempFilePath)
870
+ } catch (error: any) {
871
+ printLog(`Error while unlinking temporary files - Error ${error}`, LogLevel.WARN)
852
872
  }
873
+
874
+ await completeVerification()
853
875
  }
854
876
  }
855
877
  )
@@ -860,7 +882,7 @@ export const verifycontribution = functionsV2.https.onCall(
860
882
  * this does not happen if the participant is actually the coordinator who is finalizing the ceremony.
861
883
  */
862
884
  export const refreshParticipantAfterContributionVerification = functionsV1
863
- .region('europe-west1')
885
+ .region("europe-west1")
864
886
  .runWith({
865
887
  memory: "512MB"
866
888
  })
@@ -943,7 +965,7 @@ export const refreshParticipantAfterContributionVerification = functionsV1
943
965
  * and verification key extracted from the circuit final contribution (as part of the ceremony finalization process).
944
966
  */
945
967
  export const finalizeCircuit = functionsV1
946
- .region('europe-west1')
968
+ .region("europe-west1")
947
969
  .runWith({
948
970
  memory: "512MB"
949
971
  })
@@ -44,7 +44,7 @@ dotenv.config()
44
44
  * @dev true when the participant can participate (1.A, 3.B, 1.D); otherwise false.
45
45
  */
46
46
  export const checkParticipantForCeremony = functions
47
- .region('europe-west1')
47
+ .region("europe-west1")
48
48
  .runWith({
49
49
  memory: "512MB"
50
50
  })
@@ -175,7 +175,7 @@ export const checkParticipantForCeremony = functions
175
175
  * 2) the participant has just finished the contribution for a circuit (contributionProgress != 0 && status = CONTRIBUTED && contributionStep = COMPLETED).
176
176
  */
177
177
  export const progressToNextCircuitForContribution = functions
178
- .region('europe-west1')
178
+ .region("europe-west1")
179
179
  .runWith({
180
180
  memory: "512MB"
181
181
  })
@@ -233,7 +233,7 @@ export const progressToNextCircuitForContribution = functions
233
233
  * 5) Completed contribution computation and verification.
234
234
  */
235
235
  export const progressToNextContributionStep = functions
236
- .region('europe-west1')
236
+ .region("europe-west1")
237
237
  .runWith({
238
238
  memory: "512MB"
239
239
  })
@@ -296,7 +296,7 @@ export const progressToNextContributionStep = functions
296
296
  * @dev enable the current contributor to resume a contribution from where it had left off.
297
297
  */
298
298
  export const permanentlyStoreCurrentContributionTimeAndHash = functions
299
- .region('europe-west1')
299
+ .region("europe-west1")
300
300
  .runWith({
301
301
  memory: "512MB"
302
302
  })
@@ -355,7 +355,7 @@ export const permanentlyStoreCurrentContributionTimeAndHash = functions
355
355
  * @dev enable the current contributor to resume a multi-part upload from where it had left off.
356
356
  */
357
357
  export const temporaryStoreCurrentContributionMultiPartUploadId = functions
358
- .region('europe-west1')
358
+ .region("europe-west1")
359
359
  .runWith({
360
360
  memory: "512MB"
361
361
  })
@@ -409,7 +409,7 @@ export const temporaryStoreCurrentContributionMultiPartUploadId = functions
409
409
  * @dev enable the current contributor to resume a multi-part upload from where it had left off.
410
410
  */
411
411
  export const temporaryStoreCurrentContributionUploadedChunkData = functions
412
- .region('europe-west1')
412
+ .region("europe-west1")
413
413
  .runWith({
414
414
  memory: "512MB"
415
415
  })
@@ -469,7 +469,7 @@ export const temporaryStoreCurrentContributionUploadedChunkData = functions
469
469
  * contributed to every selected ceremony circuits (= DONE).
470
470
  */
471
471
  export const checkAndPrepareCoordinatorForFinalization = functions
472
- .region('europe-west1')
472
+ .region("europe-west1")
473
473
  .runWith({
474
474
  memory: "512MB"
475
475
  })
@@ -193,8 +193,10 @@ export const createBucket = functions
193
193
  CORSConfiguration: {
194
194
  CORSRules: [
195
195
  {
196
- AllowedMethods: ["GET"],
197
- AllowedOrigins: ["*"]
196
+ AllowedMethods: ["GET", "PUT"],
197
+ AllowedOrigins: ["*"],
198
+ ExposeHeaders: ["ETag", "Content-Length"],
199
+ AllowedHeaders: ["*"]
198
200
  }
199
201
  ]
200
202
  }
@@ -407,7 +409,8 @@ export const startMultiPartUpload = functions
407
409
  export const generatePreSignedUrlsParts = functions
408
410
  .region("europe-west1")
409
411
  .runWith({
410
- memory: "512MB"
412
+ memory: "512MB",
413
+ timeoutSeconds: 300
411
414
  })
412
415
  .https.onCall(
413
416
  async (
@@ -41,7 +41,8 @@ export const registerAuthUser = functions
41
41
  // Reference to a document using uid.
42
42
  const userRef = firestore.collection(commonTerms.collections.users.name).doc(uid)
43
43
  // html encode the display name (or put the ID if the name is not displayed)
44
- const encodedDisplayName = user.displayName === "Null" || user.displayName === null ? user.uid : encode(displayName)
44
+ const encodedDisplayName =
45
+ user.displayName === "Null" || user.displayName === null ? user.uid : encode(displayName)
45
46
 
46
47
  // store the avatar URL of a contributor
47
48
  let avatarUrl: string = ""
@@ -73,13 +74,22 @@ export const registerAuthUser = functions
73
74
  makeError(
74
75
  "permission-denied",
75
76
  "The user is not allowed to sign up because their Github reputation is not high enough.",
76
- `The user ${user.displayName === "Null" || user.displayName === null ? user.uid : user.displayName } is not allowed to sign up because their Github reputation is not high enough. Please contact the administrator if you think this is a mistake.`
77
+ `The user ${
78
+ user.displayName === "Null" || user.displayName === null
79
+ ? user.uid
80
+ : user.displayName
81
+ } is not allowed to sign up because their Github reputation is not high enough. Please contact the administrator if you think this is a mistake.`
77
82
  )
78
83
  )
79
- }
84
+ }
80
85
  // store locally
81
86
  avatarUrl = avatarURL
82
- printLog(`Github reputation check passed for user ${user.displayName === "Null" || user.displayName === null ? user.uid : user.displayName }`, LogLevel.DEBUG)
87
+ printLog(
88
+ `Github reputation check passed for user ${
89
+ user.displayName === "Null" || user.displayName === null ? user.uid : user.displayName
90
+ }`,
91
+ LogLevel.DEBUG
92
+ )
83
93
  } catch (error: any) {
84
94
  // Delete user
85
95
  await auth.deleteUser(user.uid)
@@ -95,7 +105,7 @@ export const registerAuthUser = functions
95
105
  }
96
106
  // Set document (nb. we refer to providerData[0] because we use Github OAuth provider only).
97
107
  // In future releases we might want to loop through the providerData array as we support
98
- // more providers.
108
+ // more providers.
99
109
  await userRef.set({
100
110
  name: encodedDisplayName,
101
111
  encodedDisplayName,
@@ -112,7 +122,7 @@ export const registerAuthUser = functions
112
122
  // we want to create a new collection for the users to store the avatars
113
123
  const avatarRef = firestore.collection(commonTerms.collections.avatars.name).doc(uid)
114
124
  await avatarRef.set({
115
- avatarUrl: avatarUrl || "",
125
+ avatarUrl: avatarUrl || ""
116
126
  })
117
127
  printLog(`Authenticated user document with identifier ${uid} has been correctly stored`, LogLevel.DEBUG)
118
128
  printLog(`Authenticated user avatar with identifier ${uid} has been correctly stored`, LogLevel.DEBUG)
package/src/lib/errors.ts CHANGED
@@ -184,6 +184,11 @@ export const SPECIFIC_ERRORS = {
184
184
  "unavailable",
185
185
  "VM command execution has been delayed since there were no available instance at the moment",
186
186
  "Please, contact the coordinator if this error persists."
187
+ ),
188
+ SE_VM_UNKNOWN_COMMAND_STATUS: makeError(
189
+ "unavailable",
190
+ "VM command execution has failed due to an unknown status code",
191
+ "Please, contact the coordinator if this error persists."
187
192
  )
188
193
  }
189
194
 
package/src/lib/utils.ts CHANGED
@@ -217,7 +217,7 @@ export const downloadArtifactFromS3Bucket = async (bucketName: string, objectKey
217
217
  const streamPipeline = promisify(pipeline)
218
218
  await streamPipeline(response.body, writeStream)
219
219
 
220
- writeStream.on('finish', () => {
220
+ writeStream.on("finish", () => {
221
221
  writeStream.end()
222
222
  })
223
223
  }
@@ -305,7 +305,7 @@ export const deleteObject = async (bucketName: string, objectKey: string) => {
305
305
 
306
306
  // Prepare command.
307
307
  const command = new DeleteObjectCommand({ Bucket: bucketName, Key: objectKey })
308
-
308
+
309
309
  // Execute command.
310
310
  const data = await client.send(command)
311
311