From aedc47e110167f1d820b8d347c269d57665ed010 Mon Sep 17 00:00:00 2001 From: Angel Caamal Date: Thu, 5 Mar 2026 17:38:57 +0000 Subject: [PATCH 1/2] fix(healthcare): set responseType to JSON instead of Buffer --- healthcare/fhir/deleteFhirResourcePurge.js | 13 +++++++++---- healthcare/fhir/system-test/fhir_resources.test.js | 4 +++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/healthcare/fhir/deleteFhirResourcePurge.js b/healthcare/fhir/deleteFhirResourcePurge.js index 16601b4f8b..1ee070e6ca 100644 --- a/healthcare/fhir/deleteFhirResourcePurge.js +++ b/healthcare/fhir/deleteFhirResourcePurge.js @@ -29,6 +29,7 @@ const main = ( auth: new google.auth.GoogleAuth({ scopes: ['https://www.googleapis.com/auth/cloud-platform'], }), + responseType: 'blob', }); const deleteFhirResourcePurge = async () => { @@ -42,10 +43,14 @@ const main = ( const name = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/fhirStores/${fhirStoreId}/fhir/${resourceType}/${resourceId}`; const request = {name}; - await healthcare.projects.locations.datasets.fhirStores.fhir.ResourcePurge( - request - ); - console.log('Deleted all historical versions of resource'); + try { + await healthcare.projects.locations.datasets.fhirStores.fhir.ResourcePurge( + request + ); + console.log(`Purged all historical versions of resource: ${resourceId}`); + } catch (error) { + console.error('Error purging FHIR resource:', error.message || error); + } }; deleteFhirResourcePurge(); diff --git a/healthcare/fhir/system-test/fhir_resources.test.js b/healthcare/fhir/system-test/fhir_resources.test.js index 61c09595fa..b7f2762bbd 100644 --- a/healthcare/fhir/system-test/fhir_resources.test.js +++ b/healthcare/fhir/system-test/fhir_resources.test.js @@ -163,7 +163,9 @@ it('should purge all historical versions of a FHIR resource', () => { {cwd} ); assert.strictEqual( - new RegExp('Deleted all historical versions of resource').test(output), + new RegExp( + `Purged all historical versions of resource: ${resourceId}` + ).test(output), true ); }); From ae749ad2a1adc8c093ef6769af7d1d4ae1f8e09c Mon Sep 17 00:00:00 2001 From: Angel Caamal Date: Thu, 5 Mar 2026 17:49:48 +0000 Subject: [PATCH 2/2] fix(healthcare): Fix response type --- healthcare/fhir/deleteFhirResourcePurge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/healthcare/fhir/deleteFhirResourcePurge.js b/healthcare/fhir/deleteFhirResourcePurge.js index 1ee070e6ca..cf1023aacb 100644 --- a/healthcare/fhir/deleteFhirResourcePurge.js +++ b/healthcare/fhir/deleteFhirResourcePurge.js @@ -29,7 +29,7 @@ const main = ( auth: new google.auth.GoogleAuth({ scopes: ['https://www.googleapis.com/auth/cloud-platform'], }), - responseType: 'blob', + responseType: 'json', }); const deleteFhirResourcePurge = async () => {