Skip to content

Requests are immediately canceled when ran in Electron  #1097

@Josep313

Description

@Josep313

Hello,

Axios cancels all subsequent requests after calling the initial requests during ComponentWillMount() phase of the ReactJS life cycle.

Afterwards, the requests are immediately canceled. Doesn't matter what phase of the ReactJS lifecycle they are called.

This only occurs when running on Electron. This problem does not persist on browser. I suspect the issue is caused by this:

    if (typeof XMLHttpRequest !== 'undefined') {
         // For browsers use XHR adapter
     axios.defaults.adapter = xhrAdapter
 } else if (typeof process !== 'undefined') {
     // For node use HTTP adapter
     axios.defaults.adapter = httpAdapter;
}

As the browser is correctly using the xhrAdapter and Electron is not using the httpAdapter. I came across a similar issue that was closed, and after following the solution, I was able to get the request to send for approx. <15 seconds before the requests started to immediately cancel again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions