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

Commit 07e0895

Browse files
author
Chris Wiechmann
committed
If currentUserRequest to ANM fails - Try it again
See #135
1 parent 9b1b3a9 commit 07e0895

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2020
- Added support for Long-Term API-Analytics based on transformation jobs
2121
- Added Quartely- and Yearly-API-Request dashboars in addition to the existing Real-Time Dashboard
2222
- Added support for Transactions [#83](https://github.com/Axway-API-Management-Plus/apigateway-openlogging-elk/issues/83)
23+
- If Current-User request to ANM fails, API-Builder is now trying it again [#135](https://github.com/Axway-API-Management-Plus/apigateway-openlogging-elk/issues/135)
2324

2425
## [3.3.2] 2021-08-30
2526
### Fixed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ async function lookupCurrentUser(params, options) {
7777
throw new Error('The requestHeaders do not contain the required header csrf-token');
7878
}
7979
logger.trace(`Trying to get current user based on VIDUSR cookie.`);
80-
user.loginName = await _getCurrentGWUser(headers = {'Cookie': requestHeaders.cookie});
80+
try {
81+
user.loginName = await _getCurrentGWUser(headers = {'Cookie': requestHeaders.cookie});
82+
} catch (err) {
83+
// Might happen if the request has been sent to the wrong ANM by a Load-Balancer in between. (Session Stickyness not working as expected)
84+
// Only mitigating the problem, but not really fully solving the issue - Load-Balanced request must be investigated
85+
logger.warn(`Unexpected error while trying to get current user from the ANM. Using a Load-Balancer which is not sticky?! Try again at least once.`);
86+
user.loginName = await _getCurrentGWUser(headers = {'Cookie': requestHeaders.cookie});
87+
}
8188
logger.trace(`Current user is: ${user.loginName}`);
8289
permissions = await _getCurrentGWPermissions(headers = {'Cookie': requestHeaders.cookie, 'csrf-token': requestHeaders['csrf-token']}, user.loginName);
8390
}

0 commit comments

Comments
 (0)