-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_tls2.default.connect is not a function #171
Comments
sounds like we're sittin in the same boat #168 |
Are you sure that the node |
The error seems to be caused by: var _tls = __webpack_require__("./node_modules/node-libs-browser/mock/empty.js");
var _tls2 = _interopRequireDefault(_tls);
...
this._socket = this.ssl ? _tls2.default.connect(this.port, this.host, {}, function () {
return _this._emit('open');
}) : _net2.default.connect(this.port, this.host, function () {
return _this._emit('open');
}); Because the error message is |
Ooooh, I think I see what the problem is... Here is the import for Can you do me a favor and put a breakpoint in line 53 of node-socket.js in the tcp-socket shim and see what the object looks like? after |
I just pushed a change where the tcp-socket integration test does not babelify on the fly and uses the transpiled pre-built sources just as any other project would consume the lib. The weird thing is: It runs fine. emailjs/emailjs-tcp-socket@a6600f0 Here's the test... https://github.com/emailjs/emailjs-tcp-socket/blob/master/test/node/node-integration.js Is your repo open so that I could check out where it breaks for you? This sucks and I can't seem to reproduce it... And one more thing: AFAIK in electron, |
It's just a test project so i don't have put into an repo. I'll test with the breakpoint you mentioned and comment the result. Also, I'll put the project in one repo and share it here. |
any news on this? |
any updates for this issue? |
@igoventura i assume that means the issue was resolved? |
@sujidivakar any news on your end? seems list @igoventura dropped out |
ping? |
Since nobody bothered to respond, i am closing this ticket for now. |
I am having this error when trying to do a progressive web app that runs on browser. Does this lib support this? |
I see why this might be confusing. The web stack traditionally does not have a concept of raw sockets. So you can't just drop the library into the browser. Does not work. However, what you might wanna look into is run a proxy that allows opening a WebSockets-TCP proxy. The emailjs stack was built to support this. Please know that this needs a lot of discussion as it might open up your proxy to a lot of abuse. You can find out more about a TCP proxy here: https://github.com/emailjs/emailjs-tcp-proxy |
@felixhammerl I'm now running the proxy on my localhost for testing, but I was unable to find how tell the application to used it. Initially I thought that options of imap-client would accept the |
You are on the right track. On the one hand, you have to run the proxy so that it can open TCP connection on your behalf, and then you need to connect to the proxy as well. Check the documentation here for how to do it: https://github.com/emailjs/emailjs-tcp-socket#web-sockets It is actually as simple as telling where to find your socket.io instance and you're good to go :) If you receive any errors down the road, but see that the general connection starts, it might be TLS certificate errors. What out for that, as the error is a bit tricky and unfortunately get thrown out of band :( |
@felixhammerl , I think I am missing something. I have cloned emaijs-tcp-proxy and ran on my localhost:
On my code I start the socket with the example code: var socket = TCPSocket.open('127.0.0.1', 9000, {
ws: {
url: 'http://localhost:8889',
options: {
upgrade: false
}
}
}) Looks like I am missing on how to start the service on port 8889. Another thing I do not know how to do is how to use the started tcpsocket with ImapClient. |
Here you go: https://github.com/emailjs/emailjs-tcp-proxy#usage-as-standalone
That should get you started. Run it on the port you're pointing the If you're serving your app from an express instance already, you can also just hook the proxy into your express instance: https://github.com/emailjs/emailjs-tcp-proxy#usage-as-standalone |
I made this, only used port 9000 but the code I pasted above still gives me the error:
|
damn. i will look into it. |
@felixhammerl ... I do not know if I am missing something or if this is a bug. I am only using emailjs on ionic running on browser served by the |
im using ionic as well. Tried the combination of tcp-proxy + tcpClient and i get the _net2.default.connect is not a function as well. Let me know if i can do more helpful stuff than just reading this feed... ;) |
hello, I have installed the library on a vue.js app and I get the same error.
How can I solve it ? |
I'm trying to use this in my angular+electron app and getting this error:
[DEBUG][2018-02-09T16:53:31.517Z][1][[email protected]][imap-mail.outlook.com] Connecting to imap-mail.outlook.com : 993 polyfills.bundle.js:3186 [DEBUG][2018-02-09T16:53:31.521Z][1][[email protected]][imap-mail.outlook.com] Entering state: 1 polyfills.bundle.js:3186 [ERROR][2018-02-09T16:53:31.534Z][1][[email protected]][imap-mail.outlook.com] Could not connect to server TypeError: _tls2.default.connect is not a function webpackJsonp../node_modules/zone.js/dist/zone-mix.js.ZoneDelegate.invoke @ polyfills.bundle.js:3186 webpackJsonp../node_modules/zone.js/dist/zone-mix.js.Zone.run @ polyfills.bundle.js:2936 console.(anonymous function) @ polyfills.bundle.js:5867 log @ vendor.bundle.js:98237 error @ vendor.bundle.js:98245 error @ vendor.bundle.js:96366 (anonymous) @ vendor.bundle.js:95481 step @ vendor.bundle.js:95368 (anonymous) @ vendor.bundle.js:95368 webpackJsonp../node_modules/zone.js/dist/zone-mix.js.ZoneDelegate.invoke @ polyfills.bundle.js:3186 onInvoke @ vendor.bundle.js:49849 webpackJsonp../node_modules/zone.js/dist/zone-mix.js.ZoneDelegate.invoke @ polyfills.bundle.js:3185 webpackJsonp../node_modules/zone.js/dist/zone-mix.js.Zone.run @ polyfills.bundle.js:2936 (anonymous) @ polyfills.bundle.js:3638 webpackJsonp../node_modules/zone.js/dist/zone-mix.js.ZoneDelegate.invokeTask @ polyfills.bundle.js:3219 onInvokeTask @ vendor.bundle.js:49840 webpackJsonp../node_modules/zone.js/dist/zone-mix.js.ZoneDelegate.invokeTask @ polyfills.bundle.js:3218 webpackJsonp../node_modules/zone.js/dist/zone-mix.js.Zone.runTask @ polyfills.bundle.js:2986 drainMicroTaskQueue @ polyfills.bundle.js:3396 polyfills.bundle.js:3186 [DEBUG][2018-02-09T16:53:31.536Z][1][[email protected]][imap-mail.outlook.com] Entering state: 5 polyfills.bundle.js:3186 [DEBUG][2018-02-09T16:53:31.537Z][1][[email protected]][imap-mail.outlook.com] Closing connection... polyfills.bundle.js:5864 ERROR Error: Uncaught (in promise): TypeError: _tls2.default.connect is not a function TypeError: _tls2.default.connect is not a function at new TCPSocket (vendor.bundle.js:100809) at Function.open (vendor.bundle.js:100785) at Promise (vendor.bundle.js:97414) at new ZoneAwarePromise (polyfills.bundle.js:3655) at Imap.connect (vendor.bundle.js:97413) at Promise (vendor.bundle.js:95493) at new ZoneAwarePromise (polyfills.bundle.js:3655) at Client._openConnection (vendor.bundle.js:95489) at vendor.bundle.js:95466 at Generator.next (<anonymous>) at new TCPSocket (vendor.bundle.js:100809) at Function.open (vendor.bundle.js:100785) at Promise (vendor.bundle.js:97414) at new ZoneAwarePromise (polyfills.bundle.js:3655) at Imap.connect (vendor.bundle.js:97413) at Promise (vendor.bundle.js:95493) at new ZoneAwarePromise (polyfills.bundle.js:3655) at Client._openConnection (vendor.bundle.js:95489) at vendor.bundle.js:95466 at Generator.next (<anonymous>) at resolvePromise (polyfills.bundle.js:3589) at resolvePromise (polyfills.bundle.js:3560) at polyfills.bundle.js:3638 at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone-mix.js.ZoneDelegate.invokeTask (polyfills.bundle.js:3219) at Object.onInvokeTask (vendor.bundle.js:49840) at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone-mix.js.ZoneDelegate.invokeTask (polyfills.bundle.js:3218) at Zone.webpackJsonp../node_modules/zone.js/dist/zone-mix.js.Zone.runTask (polyfills.bundle.js:2986) at drainMicroTaskQueue (polyfills.bundle.js:3396) at <anonymous>
The text was updated successfully, but these errors were encountered: