Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

https calls not working #172

Closed
arielhenryson opened this issue Sep 19, 2016 · 13 comments
Closed

https calls not working #172

arielhenryson opened this issue Sep 19, 2016 · 13 comments

Comments

@arielhenryson
Copy link

In the new version when I try to make a HTTPS request to third-party APIs server, I'm getting this error

{ Error: socket hang up
at TLSSocket.onHangUp (_tls_wrap.js:1092:19)
at TLSSocket.g (events.js:291:16)
at ZoneDelegate.invokeTask (/xxx/xxx/xxx/xxx/node_modules/zone.js/dist/zone-node.js:225:37)
at Zone.runTask (/xxx/xxx/xxx/xxx/node_modules/zone.js/dist/zone-node.js:125:47)
at TLSSocket.ZoneTask.invoke (/xxx/xxx/xxx/xxx/node_modules/zone.js/dist/zone-node.js:293:33)
at emitNone (events.js:91:20)
at TLSSocket.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9) code: 'ECONNRESET' }

the code is something like this

const request = require('request');
const url = "https://xxx.xxx.xxx";
request(url, function (err, response, body) {
   console.log(err);
   console.log(response);
   console.log(body);
});
@MarkPieszak
Copy link
Contributor

Do you have a fresh repo, or have you completely removed your node_modules folder and then reinstalled everything?

Also can you try updating your Universal depdencies to the latest 2.0.10 version, wondering if those could be the problem as well.

"angular2-platform-node": "~2.0.10",
"angular2-universal": "~2.0.10",
"angular2-universal-polyfills": "~2.0.10",
"angular2-express-engine": "~2.0.10",

@arielhenryson
Copy link
Author

Just to make sure I deleted my node_modules folder and updated the universal stuff as you suggest but the problem is still there.

@PatrickJS
Copy link
Contributor

can you try with zone.js 0.6.21?

@arielhenryson
Copy link
Author

I rolled back Zone from 0.6.25 to 0.6.21 and now it's working again
i did a file compare between the versions and i see that in version 0.6.25 there is a new code in the zone-node.js related to HTTP so maybe that's is the problem

But I have a question.I don't understand why in the server-side Zone takes control over global stuff. I understand why in the browser Zone it needs to be aware of a lot of stuff that is happening and that's why it's overwrite stuff that are related to the "window" object but I don't understand why in the sever side it's not working with some sort of namespace. Would it be better ?! because in the server side there is a lot of stuff that are not related to Angular like simple APIs endpoint. so I think that if in the server-side Zone will touch stuff that he is not supposed to touch and i would want to work with Angular universal, I would have to change my app to work in a micro services architecture where stuff that are not related to Angular will work on a different isolated process

@PatrickJS
Copy link
Contributor

cc @alxhub

@jeffwhelpley
Copy link

@gdi2290 is this related to #164?

@PatrickJS
Copy link
Contributor

if you want to isolate zone.js then you would want angular to run in an isolated process outside of your server app as you suggested. We use zone.js to track async calls that are being made before converting the app into a string to send down to the client. We also use it to proxy globals such as document (and more in the future) for when the developer doesn't have control over the implementation (3rd party modules) and doesn't want to split the code at the module level. In the future, we can provide different workarounds for these globals and allow Zone.js to be optional if the developer's app also works without zone.js

@AMar4enko
Copy link

AMar4enko commented Oct 10, 2016

Same here - request to https results in "Socket hung up" with 0.6.25, something was definitely broken. Downgrading to 0.6.21 resolved the issue, thanks @arielhenryson

@PatrickJS
Copy link
Contributor

can you report these issues in the angular/zone.js repo

@PatrickJS
Copy link
Contributor

update to zone 0.6.26 should fix the issue

@arielhenryson
Copy link
Author

I updated the version and the problem still exists

@PatrickJS
Copy link
Contributor

@arielhenryson can you create an issue in zone.js and provide a repo that reproduces the problem

@John0x
Copy link
Contributor

John0x commented Nov 23, 2016

@gdi2290 the newest zone.js probably fixes this issue (stated in the zone.js issue).
Universal and Universal-polyfills require the 0.6.21 version, can you please update them?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants