Skip to content

Commit

Permalink
fix some metadata acquisition when logging errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Fallon committed Nov 10, 2021
1 parent 57eb3e2 commit 4c40c45
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions api/services/acquisition/src/actions/LogRequestAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,21 @@ export class LogRequestAction extends AbstractAction {

protected async handle(params: ParamsInterface, context: ContextType): Promise<ResultInterface> {
// clean up sensitive data
delete params.headers.cookie;
if ('headers' in params && 'cookie' in params.headers) {
delete params.headers.cookie;
}

if ('headers' in params && 'authorization' in params.headers) {
delete params.headers.authorization;
}

await this.repo.log({
error_stage: ErrorStage.Acquisition,
error_line: null,
operator_id: get(context, 'call.user.operator_id', params.operator_id || 0),
journey_id: params.journey_id,
journey_id: get(params, 'body.journey_id', get(params, 'journey_id', null)),
source: 'logrequest',
request_id: get(params, 'request_id', get(params, 'headers.x-request-id'), null),
error_message: null,
error_code: null,
auth: get(context, 'call.user'),
Expand Down

0 comments on commit 4c40c45

Please sign in to comment.