Requests are immediately canceled when ran in Electron
See original GitHub issueHello,
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.
- axios version: “0.16.2”,
- Environment: Node v6.11.3 Chrome 61, Windows 10*
- Network output from Developer Console
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
node.js - Electron application exits immediately after starting
Electron 5 was installed in the local node_modules. I was able to develop and run the application from VSCode. I ran 'ncu' and...
Read more >app | Electron
If callback is called without a username or password, the authentication request will be cancelled and the authentication error will be returned to...
Read more >All of the Documentation | Electron - GitHub Pages
However, the request remains active until either the application becomes active or the request is canceled. Returns Integer an ID representing the request....
Read more >The Ultimate Guide to Electron with React | by Aditya Patnaik
Let's quickly set up a react app with Electron. It is assumed that you have node and npm installed. Create a folder named...
Read more >7.5: Electron Affinities - Chemistry LibreTexts
The electron affinity (EA) of an element is the energy change that ... than those of the elements immediately below them in the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Also got trouble using Axios 0.19.0 in Electron 6.1.4 + Node 10.16.3.
I didn’t investigate it fully, but around 30-50% of the requests got “lost” and never returned a response.
This fixed it for me (in the frontend/Vue.js code of the Electron app):
Hello! 👋
This issue is being automatically marked as stale because it has not been updated in a while. Please confirm that the issue is still present and reproducible. If no updates or new comments are received the issue will be closed in a few days.
Thanks.