open-ux-tools icon indicating copy to clipboard operation
open-ux-tools copied to clipboard

BUG - Improve error logging of axios extension

Open zdravko-georgiev opened this issue 4 months ago • 0 comments

Description

In the axios-extension when an AxiosError is thrown, helper methods are used to output the error in the console. E.g. tryLogResponse. The issue with this approach is that error.response is not always defined. E.g. if an error about self-signed certificate is thrown the the AxiosError doesn't contain a response:

{
  "message": "unable to get local issuer certificate",
  "name": "Error",
  "stack": "Error: unable to get local issuer certificate...",
  "config": {
    "params": {...},
    "baseURL": "https://<hostname>/sap/bc/lrep",
    "auth": {...},
    "httpsAgent": {...},
    "withCredentials": true,
    "headers": {...},
    "publicUrl": "https://<hostname>",
    "method": "get",
    "url": "/actions/getcsrftoken/"
    "data": {...}
  },
  "code": "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
  "status": null,
  "request": {...}
}

In this case the root cause of the issue might be found in error.config.data.

The same can be observed when a user is behind a corporate proxy, but the axios is not are of the corporate proxy. Then the request will fail with 503 Service Unavailable. Then the following additional information can be found in the errror object:

The following error was encountered while trying to retrieve the URL: "xxxx/sap/bc/lrep/actions/getcsrftoken/?"
Unable to determine IP address from host name "xxxx"
The DNS server returned: "Name Error: The domain name does not exist."
This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct

Expected results

Clear message of what the root cause of the issue is

Actual results

This is not always the case

Screenshots

If applicable, add screenshots to help explain the problem.

Version/Components/Environment

Add any other context about the problem here OS:

  • [x] Mac OS
  • [x] Windows
  • [ ] Other

Root Cause Analysis

Problem

{describe the problem}

Fix

{describe the fix}

Why was it missed

{Some explanation why this issue might have been missed during normal development/testing cycle}

How can we avoid this

{if we don’t want to see this type of issues anymore what we should do to prevent}

zdravko-georgiev avatar Mar 01 '24 12:03 zdravko-georgiev