From 73b64c4c7678ccdfe4f83acb9547afbea69af9d3 Mon Sep 17 00:00:00 2001 From: Martin Brocker Date: Mon, 20 May 2024 09:36:29 +0200 Subject: [PATCH] Fix incorrect Axios auth usage The Auth being injected into Axios was not defined correctly and thus not being applied The auth credentials need to be defined inside an auth object inside the header object https://axios-http.com/docs/req_config --- server/lib/tools/cacheFHIR.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/lib/tools/cacheFHIR.js b/server/lib/tools/cacheFHIR.js index aecb223a..e440b743 100644 --- a/server/lib/tools/cacheFHIR.js +++ b/server/lib/tools/cacheFHIR.js @@ -239,7 +239,7 @@ const updateESCompilationsRate = callback => { username: config.get('elastic:username'), password: config.get('elastic:password'), }; - axios.put(url, body, auth).then(response => { + axios.put(url, body, { auth }).then(response => { if (response.status > 199 && response.status < 299) { logger.info('maximum compilation rate updated successfully'); return callback(false); @@ -287,7 +287,7 @@ const createESIndex = (name, IDFields, reportFields, callback) => { username: config.get('elastic:username'), password: config.get('elastic:password'), }; - axios.put(url, settings, auth).then(response => { + axios.put(url, settings, { auth }).then(response => { if (response.status >= 200 && response.status <= 299) { logger.info('Analyzer created successfully'); return callback(null); @@ -345,7 +345,7 @@ const createESIndex = (name, IDFields, reportFields, callback) => { username: config.get('elastic:username'), password: config.get('elastic:password'), }; - axios.put(url, mapping, auth).then(response => { + axios.put(url, mapping, { auth }).then(response => { if (response.status >= 200 && response.status <= 299) { logger.info('Mappings added successfully into elasticsearch'); return callback(null); @@ -389,7 +389,7 @@ const updateESDocument = (id, index, record, callback) => { username: config.get('elastic:username'), password: config.get('elastic:password') }; - axios.post(url, record, auth).then(response => { + axios.post(url, record, { auth }).then(response => { logger.info(response.data); if (response.data._shards.failed) { logger.warn('Transaction failed, rerunning again');