nolancaster / angular2-actioncable

Integrate ActionCable with Angular2+
25 stars 16 forks source link

Error when subscription is rejected #8

Closed c2ops closed 5 years ago

c2ops commented 5 years ago

Hello,

I'm trying to reject a subscription to a channel but following JavaScript Error is throwing:

core.js:15723 ERROR TypeError: Cannot read property 'received' of undefined
    at Subscriptions.push../node_modules/actioncable/lib/assets/compiled/action_cable.js.ActionCable.Subscriptions.Subscriptions.notify (action_cable.js:493)
    at Connection.message (action_cable.js:347)
    at WebSocket.wrapFn (zone.js:1281)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:17289)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:498)
    at invokeTask (zone.js:1693)
    at WebSocket.globalZoneAwareCallback (zone.js:1719)

Though the rejected callback is successfully called

I'm using:

I also tried some older versions of this plugin and rxjs but resulted in the same problem.

Does anyone has a solution? Thank you :)

nolancaster commented 5 years ago

This error is happening in ActionCable itself so it's hard to say what's going on. I'll try to look into it some more though. If you throw a breakpoint on the line the error is happening, you might be able to get some more information. It looks like you have an undefined value in the subscriptions array.

c2ops commented 5 years ago

Thanks for your answer. I just figured out that it is only happening when I transmit a custom error before rejecting the subscription. So if I just reject no error is thrown. I think we can close this issue :)