Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

0.7.1 Breaking Error #515

Closed
antonyRoberts opened this issue Nov 22, 2016 · 10 comments
Closed

0.7.1 Breaking Error #515

antonyRoberts opened this issue Nov 22, 2016 · 10 comments

Comments

@antonyRoberts
Copy link

antonyRoberts commented Nov 22, 2016

Upgrading to zone 0.7.1 from 0.6.26, with @JiaLiPassion zone-node file, breaks app on start with

TypeError: Error.captureStackTrace is not a function.

nodemon] 1.11.0
[nodemon] to restart at any time, enter rs
[nodemon] watching: C:\apps\UniversalMaterialBreak\dist/**/* src/index.html
[nodemon] starting node dist/server/index.js
C:\apps\UniversalMaterialBreak\node_modules\depd\lib\compat\index.js:39
Error.captureStackTrace(obj)
^

TypeError: Error.captureStackTrace is not a function
at callSiteToString (C:\apps\UniversalMaterialBreak\node_modules\depd\lib\compat\index.js:39:9)
at Object.get [as callSiteToString] (C:\apps\UniversalMaterialBreak\node_modules\depd\lib\compat\index.js:60:15)
[nodemon] app crashed - waiting for file changes before starting...

Repo showing issue.

@JiaLiPassion
Copy link
Collaborator

JiaLiPassion commented Nov 23, 2016

zone-node.js.zip

it seems ZoneAwareError not inherit captureStackTrace method, I made a pull request #516 to fix this one. you can use the attched zone-node.js for test.

@antonyRoberts
Copy link
Author

After your patch getting

C:\apps\UniversalMaterialBreak\node_modules\depd\index.js:252
var file = callSite.getFileName() || ''
^
TypeError: callSite.getFileName is not a function
at callSiteLocation (C:\apps\UniversalMaterialBreak\node_modules\depd\index.js:252:23)
at depd (C:\apps\UniversalMaterialBreak\node_modules\depd\index.js:112:14)
at Object. (C:\apps\UniversalMaterialBreak\node_modules\express\lib\router\index.js:21:32)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)
at Object. (C:\apps\UniversalMaterialBreak\node_modules\express\lib\application.js:17:14)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
[nodemon] app crashed - waiting for file changes before starting...

@JiaLiPassion
Copy link
Collaborator

yes, we should also patch prepareStackTrace, you can
try this one.

zone-node.js.zip

@JiaLiPassion
Copy link
Collaborator

It has been fixed, please use the newest version to test.

@haia212
Copy link

haia212 commented Dec 22, 2016

I have the same issue and the last update of zone-node.js doesn't correct it. (I use [email protected] with the zone-node.js replaced by the last one you sent)

The stacktrace I currently have is :

Error: socket hang up
    at createHangUpError (_http_client.js:253:15) [angular]
    at Socket.socketCloseListener (_http_client.js:285:23) [angular]
    at Object.onInvokeTask (/universal/dist/server/index.js:26908:37) [angular]
    at ZoneDelegate.invokeTask (/universal/node_modules/zone.js/dist/zone-node.js:261:40) [angular]
    at Zone.runTask (/universal/node_modules/zone.js/dist/zone-node.js:151:47) [<root> => angular]
    at Socket.ZoneTask.invoke (/universal/node_modules/zone.js/dist/zone-node.js:332:33) [<root>]
    at emitOne (events.js:101:20) [<root>]
    at Socket.emit (events.js:188:7) [<root>]
    at TCP._handle.close [as _onclose] (net.js:501:12) [<root>]

Do you have a fix ?

I also try update to [email protected] but the npm install failed with UNMET PEER DEPENDENCY [email protected]

@JiaLiPassion
Copy link
Collaborator

@haia212, I will try the repo to test it again.

@JiaLiPassion
Copy link
Collaborator

@haia212, I have tried the repo provide by antonyRoberts here is ok in my environment (with zone.js 0.7.4), could you provide your test repo?

@haia212
Copy link

haia212 commented Dec 29, 2016

After some digging, (I don't understand why but) the problem come from the fact that I keep the subscription in an array to unsubscribe all my subscription onDestroy.

private _subscriptions = [];
ngOnInit() {
    this._subscriptions.push(
        this.myAccountService.getSubscriptionPlan().subscribe((response: MyAccount.Subscription) => this.subscription = response)
    );
} 
ngOnDestroy() {
    this._subscriptions.forEach((s) => s.unsubscribe());
  }

If I remove this subscriptions array, everything works fine.
This code outside universal works also fine.

If you have any idea why from I all hear !
Thanks !

@JiaLiPassion
Copy link
Collaborator

@haia212, could you provide a reproduce repo?

@antonyRoberts
Copy link
Author

Was fixed in 0.7.4

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

3 participants