Closed xavdid closed 4 years ago
I am having the same problem :(
edit: bit more information. Tried this on node 0.12.9 and 5.4.
@octatone can you take a look?
@LoungeFlyZ saw your tweet and got curious ;)
Using https://github.com/driverdan/node-XMLHttpRequest version 1.6.0 seemed to fix it? (instead of ^1.6.0, which pulls in the latest non-2.* thing).
Reject is bound to 'error' here, which makes sense https://github.com/wunderlist/wunderlist.js/blob/master/public/io/IOBase.js#L194
but then xmlhttprequest appears to call abort() when opening the request https://github.com/driverdan/node-XMLHttpRequest/blob/554280a7c509c1ce4d7ad9516b46d182739e8026/lib/XMLHttpRequest.js#L157
which then (accidentally?) dispatches the 'abort' event as a side effect it looks xmlhttprequest didn't always dispatch the 'abort' event, it was introduced in September old: https://github.com/driverdan/node-XMLHttpRequest/blob/1.6.0/lib/XMLHttpRequest.js#L521 now: https://github.com/driverdan/node-XMLHttpRequest/commit/94a27f11bce860b280568dd5751a19125b45a3af
which then is treated like a failure https://github.com/wunderlist/wunderlist.js/blob/master/public/io/io/AjaxTransport.js#L257
which then invokes reject :( https://github.com/wunderlist/wunderlist.js/blob/master/public/io/io/AjaxTransport.js#L270
That's frustrating! What's the best course of action? Locally we can adjust the dependencies with shrinkwrap, but we should also actually fix the issue. Do you want to do a new release that specifies 1.6.0 or change the code so that an error message is bubbled up when a request is rejected?
@Xavdidtheshadow probably nothing needs to be changed in this repo (I'm new to this codebase)? Any patches would break proper behavior when .abort()
is called normally. I would call it a bug that open
always emits an abort
event in the xmlhttprequest lib. Whatever they want that .abort()
call to do could be refactored out into something else that's less of a trap?
https://github.com/driverdan/node-XMLHttpRequest/blob/554280a7c509c1ce4d7ad9516b46d182739e8026/lib/XMLHttpRequest.js#L157
edit - went ahead and asked if they are doing it on purpose - https://github.com/driverdan/node-XMLHttpRequest/issues/125
I'll remove the ^ for now. This should be tied to specific dependencies not the loosey goosey ^ that keeps rearing its ugly head in many modules.
Following the basic example I'm unable to get a result. I can't give more specific examples because there doesn't seem to be a way to surface error codes? Curiously, I can get a result using bare request (and curl). My code (running on an express server):
SDK version is
0.1.2
. Any ideas? Let me know if I can provide any other info.