Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit 1761299

Browse files
author
Chris Wiechmann
committed
Don't throw an error for now, if the topology cannot be loaded
to avoid the application to fail for this reason. Will enabled later, once the EMT-Feature is settled.
1 parent 8eaae2e commit 1761299

File tree

1 file changed

+8
-4
lines changed
  • apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/src

1 file changed

+8
-4
lines changed

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/src/actions.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ async function lookupTopology(params, options) {
129129
var topology;
130130
if(requestHeaders.authorization) {
131131
logger.debug(`Trying to get API-Gateway topology based on Authorization header.`);
132-
topology = await _getTopology(headers = {'Authorization': `${requestHeaders.authorization}`});
132+
topology = await _getTopology(headers = {'Authorization': `${requestHeaders.authorization}`}, options);
133133
} else {
134134
logger.trace(`Trying to get API-Gateway topology based on VIDUSR cookie.`);
135-
topology = await _getTopology(headers = {'Cookie': requestHeaders.cookie, 'csrf-token': requestHeaders['csrf-token']});
135+
topology = await _getTopology(headers = {'Cookie': requestHeaders.cookie, 'csrf-token': requestHeaders['csrf-token']}, options);
136136
}
137137
if(topology.services) {
138138
topology.services = topology.services.filter(function(service) {
@@ -453,7 +453,7 @@ async function _getCurrentGWUser(requestHeaders) {
453453
return loginName;
454454
}
455455

456-
async function _getTopology(requestHeaders) {
456+
async function _getTopology(requestHeaders, options) {
457457
var options = {
458458
path: '/api/topology',
459459
headers: requestHeaders,
@@ -464,7 +464,11 @@ async function _getTopology(requestHeaders) {
464464
return response.body.result;
465465
})
466466
.catch(err => {
467-
throw new Error(`Error getting API-Gateway topology from Admin-Node-Manager. Request sent to: '${pluginConfig.apigateway.url}'. Response-Code: ${err.statusCode}`);
467+
options.logger.error(`Error getting API-Gateway topology from Admin-Node-Manager. Request sent to: '${pluginConfig.apigateway.url}'. Response-Code: ${err.statusCode}`);
468+
options.logger.error(`This error will cause the application to fail in a future release.`);
469+
return {};
470+
// During a grace period it not cause the entire application to fail - Just EMT will not include all services.
471+
//throw new Error(`Error getting API-Gateway topology from Admin-Node-Manager. Request sent to: '${pluginConfig.apigateway.url}'. Response-Code: ${err.statusCode}`);
468472
});
469473
return topology;
470474
}

0 commit comments

Comments
 (0)