particle-iot / softap-setup-js

Particle SoftAP Setup for JavaScript
Apache License 2.0
35 stars 27 forks source link

Error: req.setTimeout() is not a function HttpSoftAP.js:42 Same error for req.abort() #19

Open ak-org opened 8 years ago

ak-org commented 8 years ago

HttpSoftAP.js:42 Uncaught TypeError: req.setTimeout is not a function_sendProtocolCommand @ HttpSoftAP.js:42__sendCommand @ SoftAP.js:182deviceInfo @ SoftAP.js:73getDeviceInfo @ searchMotiWifi.js:220clickMyWifiIsMoti @ searchMotiWifi.js:77(anonymous function) @ template.js:496Template._withTemplateInstanceFunc @ template.js:465(anonymous function) @ template.js:495(anonymous function) @ view.js:884Blaze._withCurrentView @ view.js:538(anonymous function) @ view.js:883(anonymous function) @ events.js:47dispatch @ jquery.js:4665elemData.handle @ jquery.js:4333 Env :

Meteor 1.4 Softap-setup library version: latest

m-mcgowan commented 7 years ago

Thanks for the bug report. I need some more info before I can reproduce this:

TechplexEngineer commented 7 years ago

I know it has been awhile since this issue was created. I spent the day digging into what is actually going on here. I have learned that meteor bundles a number of browserify modules and stubs them in as needed. I think that something in that process is slightly broken or at least different enough from how the browserify tool works to break the req.setTimeout and req.abort.

I've created a minimal reproduction repo here: https://github.com/TechplexEngineer/meteor-http-browserify-repro/tree/master

And filed a related issue here: https://github.com/meteor/node-stubs/issues/9

Any thoughts or insights would be appreciated.

m-mcgowan commented 7 years ago

Thank you for taking the time to make the test case. We will look into it!

incorvia commented 6 years ago

The same issue is true within react native. I have proposed a solution here: https://github.com/spark/softap-setup-js/issues/40.

My guess, and I haven't looked into this, is that meteor is probably using http-browserify which provides a "http" implementation for the browser. Their implementation does not provide the setTimeout function. This is similar to how in react native "react-native-http" provides the "http" implementation and it also does not provide the setTimeout function.