This issue occurs during running unit tests using Jest.
console.log
{
level: 'error',
message: 'Network Error',
timestamp: '2020-09-21 14:19:18',
config: {
url: 'https://www.parliament.nz/en/pb/petitions/open?Criteria.Sort=IOBClosingDate&Criteria.Direction=Ascending&Criteria.page=Petitions&Criteria.ViewAll=1',
method: 'get',
headers: {
Accept: 'application/json, text/plain, */*',
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36 RuxitSynthetic/1.0 v6217406660 t38550 ath9b965f92 altpub',
'Accept-Charset': 'utf-8'
},
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: xhrAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
data: undefined
},
request: XMLHttpRequest {},
response: undefined,
isAxiosError: true,
toJSON: [Function: toJSON],
stack: 'Error: Network Error\n' +
///....
"testEnvironment": "node"
the message does not show up on console anymore. However, Jest is using a browser like environment. This indicates the issue will still persists when using a browser.