From ae206a2ae2a7e03fe404b1bf42776413a744a2b4 Mon Sep 17 00:00:00 2001 From: Angel Caamal Date: Fri, 20 Feb 2026 23:05:14 +0000 Subject: [PATCH 1/3] fix(healtcare): update FHIR response handling from buffer to JSON --- healthcare/fhir/createFhirResource.js | 1 + 1 file changed, 1 insertion(+) diff --git a/healthcare/fhir/createFhirResource.js b/healthcare/fhir/createFhirResource.js index 1457b1079f..92a796f672 100644 --- a/healthcare/fhir/createFhirResource.js +++ b/healthcare/fhir/createFhirResource.js @@ -30,6 +30,7 @@ function main( scopes: ['https://www.googleapis.com/auth/cloud-platform'], }), headers: {'Content-Type': 'application/fhir+json'}, + responseType: 'json', }); async function createFhirResource() { From 57ae719046774f8766c0df8fd02fea0857c708fe Mon Sep 17 00:00:00 2001 From: Angel Caamal Date: Mon, 23 Feb 2026 18:27:46 +0000 Subject: [PATCH 2/3] chore(healthcare): update copyright format to pass test --- healthcare/fhir/createFhirResource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/healthcare/fhir/createFhirResource.js b/healthcare/fhir/createFhirResource.js index 92a796f672..313fad5ef6 100644 --- a/healthcare/fhir/createFhirResource.js +++ b/healthcare/fhir/createFhirResource.js @@ -1,5 +1,5 @@ /** - * Copyright 2020, Google, LLC + * Copyright 2020 Google LLC * Licensed under the Apache License, Version 2.0 (the `License`); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at From de86768d736361ff609ad6010bc413ac303bc4c8 Mon Sep 17 00:00:00 2001 From: Angel Caamal Date: Thu, 26 Feb 2026 15:53:25 +0000 Subject: [PATCH 3/3] fix(healthcare): Add error handling to sample --- healthcare/fhir/createFhirResource.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/healthcare/fhir/createFhirResource.js b/healthcare/fhir/createFhirResource.js index 313fad5ef6..923a73bf10 100644 --- a/healthcare/fhir/createFhirResource.js +++ b/healthcare/fhir/createFhirResource.js @@ -51,13 +51,17 @@ function main( // const resourceType = 'Patient'; const parent = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/fhirStores/${fhirStoreId}`; - const request = {parent, type: resourceType, requestBody: body}; - const resource = - await healthcare.projects.locations.datasets.fhirStores.fhir.create( - request - ); - console.log(`Created FHIR resource with ID ${resource.data.id}`); - console.log(resource.data); + try { + const request = {parent, type: resourceType, requestBody: body}; + const resource = + await healthcare.projects.locations.datasets.fhirStores.fhir.create( + request + ); + console.log(`Created FHIR resource with ID ${resource.data.id}`); + console.log(resource.data); + } catch (error) { + console.error('Error creating FHIR resource:', error.message || error); + } } createFhirResource();