TypeError: observer.subscribe is not a function


#1

I need help debugging this error: I’m not sure why I’m getting this, but it doesn’t happen all the time. Any suggestions on how to trace this down and squash it would be greatly appreciated.

ERROR [app-router] TypeError: observer.subscribe is not a function
    at ChildInterpolationBinding.addObserver (webpack-internal:///./node_modules/aurelia-binding/dist/native-modules/aurelia-binding.js:192:14)
    at ChildInterpolationBinding.observeProperty (webpack-internal:///./node_modules/aurelia-binding/dist/native-modules/aurelia-binding.js:207:15)
    at AccessMember.connect (webpack-internal:///./node_modules/aurelia-binding/dist/native-modules/aurelia-binding.js:1512:15)
    at ChildInterpolationBinding.connect (webpack-internal:///aurelia-templating-binding:298:27)
    at enqueueBindingConnect (webpack-internal:///./node_modules/aurelia-binding/dist/native-modules/aurelia-binding.js:272:13)
    at ChildInterpolationBinding.bind (webpack-internal:///aurelia-templating-binding:271:84)
    at View.bind (webpack-internal:///./node_modules/aurelia-templating/dist/native-modules/aurelia-templating.js:1735:19)
    at Controller.bind (webpack-internal:///./node_modules/aurelia-templating/dist/native-modules/aurelia-templating.js:3785:17)
    at View.bind (webpack-internal:///./node_modules/aurelia-templating/dist/native-modules/aurelia-templating.js:1745:22)
    at Controller.bind (webpack-internal:///./node_modules/aurelia-templating/dist/native-modules/aurelia-templating.js:3785:17)
    at Controller.automate (webpack-internal:///./node_modules/aurelia-templating/dist/native-modules/aurelia-templating.js:3730:10)
    at ready (webpack-internal:///./node_modules/aurelia-templating-router/dist/native-modules/router-view.js:168:38)
    at RouterView.swap (webpack-internal:///./node_modules/aurelia-templating-router/dist/native-modules/router-view.js:197:12)
    at eval (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:285:27)
    at Array.forEach (<anonymous>)
    at eval (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:284:18)
From previous event:
    at NavigationInstruction._commitChanges (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:283:31)
    at CommitChangesStep.run (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:119:34)
    at next (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:464:18)
    at iterate (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1373:12)
    at processActivatable (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1376:10)
    at ActivateNextStep.run (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1260:12)
    at next (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:464:18)
    at iterate (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1292:12)
    at processDeactivatable (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1295:10)
    at DeactivatePreviousStep.run (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1248:12)
    at next (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:464:18)
    at iterate (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1373:12)
    at inspect (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1350:14)
    at eval (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1366:18)
    at processPotential (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1484:12)
    at iterate (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1365:16)
    at processActivatable (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1376:10)
    at CanActivateNextStep.run (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1236:12)
From previous event:
    at LoadRouteStep.run (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1514:66)
    at next (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:464:18)
    at iterate (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1292:12)
    at processDeactivatable (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1295:10)
    at CanDeactivatePreviousStep.run (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1224:12)
    at next (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:464:18)
    at eval (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:630:14)
From previous event:
    at BuildNavigationPlanStep.run (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:625:56)
    at next (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:464:18)
    at Pipeline.run (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:477:12)
    at eval (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1851:23)
From previous event:
    at AppRouter._dequeueInstruction (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1805:30)
    at eval (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1796:15)
From previous event:
    at AppRouter._queueInstruction (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1793:12)
    at eval (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1739:22)
From previous event:
    at AppRouter.loadUrl (webpack-internal:///./node_modules/aurelia-router/dist/native-modules/aurelia-router.js:1738:51)
    at BrowserHistory._loadUrl (webpack-internal:///aurelia-history-browser:300:53)
    at BrowserHistory._checkUrl (webpack-internal:///aurelia-history-browser:293:12)
aurelia-task-queue.js?2bf4:45 Uncaught TypeError: observer.subscribe is not a function
    at ChildInterpolationBinding.addObserver (aurelia-binding.js?5f98:101)
    at ChildInterpolationBinding.observeProperty (aurelia-binding.js?5f98:116)
    at AccessMember.connect (aurelia-binding.js?5f98:1421)
    at ChildInterpolationBinding.call (aurelia-templating-binding.js?570d:229)
    at ExpressionObserver.callSubscribers (aurelia-binding.js?5f98:304)
    at ExpressionObserver.call (aurelia-binding.js?5f98:419)
    at SetterObserver.callSubscribers (aurelia-binding.js?5f98:304)
    at SetterObserver.call (aurelia-binding.js?5f98:3726)
    at TaskQueue._flushQueue (aurelia-task-queue.js?2bf4:89)
    at TaskQueue.flushMicroTaskQueue (aurelia-task-queue.js?2bf4:140)
    at MutationObserver.eval (aurelia-task-queue.js?2bf4:65)


#2

@CRL It’s an issue coming from a text interpolation binding. Could you also paste the relevant html? If you are unable to locate the html, you could try commenting out some part of your app to see where it comes from


#3

@bigopon Thank-you. It appears there was a string property on the object called (.toString) that I think was conflicting with the object.ToString() function. Even though it was referenced without the function (), it would still every now and then throw the error. The weird part is that not all the time. There are times when the code would display correctly without throwing the error. Either way, thank-you again for pointing me in the right direction.