Skip to content
This repository has been archived by the owner on Jun 13, 2020. It is now read-only.

angular-app.js:63390 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'lastIndexOf' of undefined #60

Open
GirishBB opened this issue Jul 28, 2019 · 4 comments

Comments

@GirishBB
Copy link

I am getting the below error in chapter 2.
Can any buddy help me out?

angular-app.js:63390 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'lastIndexOf' of undefined
TypeError: Cannot read property 'lastIndexOf' of undefined
at Function.getNodeName (angular-app.js:20155)
at ModelStore.insertData (angular-app.js:19591)
at angular-app.js:18806
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (angular-app.js:12904)
at Object.onInvoke (angular-app.js:82783)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (angular-app.js:12903)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (angular-app.js:12663)
at angular-app.js:13423
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (angular-app.js:12936)
at Object.onInvokeTask (angular-app.js:82774)
at resolvePromise (angular-app.js:13365)
at resolvePromise (angular-app.js:13322)
at angular-app.js:13426
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (angular-app.js:12936)
at Object.onInvokeTask (angular-app.js:82774)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (angular-app.js:12935)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (angular-app.js:12708)
at drainMicroTaskQueue (angular-app.js:13114)
defaultErrorLogger @ angular-app.js:63390
push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ angular-app.js:63438
next @ angular-app.js:83284
schedulerFn @ angular-app.js:80427
push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub @ angular-app.js:97646
push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next @ angular-app.js:97584
push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next @ angular-app.js:97528
push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next @ angular-app.js:97505
push../node_modules/rxjs/_esm5/internal/Subject.js.Subject.next @ angular-app.js:97271
push../node_modules/@angular/core/fesm5/core.js.EventEmitter.emit @ angular-app.js:80411
(anonymous) @ angular-app.js:82805
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ angular-app.js:12904
push../node_modules/zone.js/dist/zone.js.Zone.run @ angular-app.js:12663
push../node_modules/@angular/core/fesm5/core.js.NgZone.runOutsideAngular @ angular-app.js:82742
onHandleError @ angular-app.js:82805
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.handleError @ angular-app.js:12908
push../node_modules/zone.js/dist/zone.js.Zone.runGuarded @ angular-app.js:12677
_loop_1 @ angular-app.js:13228
api.microtaskDrainDone @ angular-app.js:13237
drainMicroTaskQueue @ angular-app.js:13121
Promise.then (async)
scheduleMicroTask @ angular-app.js:13097
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ angular-app.js:12926
onScheduleTask @ angular-app.js:12814
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ angular-app.js:12917
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ angular-app.js:12751
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask @ angular-app.js:12771
scheduleResolveOrReject @ angular-app.js:13413
resolvePromise @ angular-app.js:13359
(anonymous) @ angular-app.js:13275
Promise.then (async)
(anonymous) @ angular-app.js:13633
ZoneAwarePromise @ angular-app.js:13444
Ctor.then @ angular-app.js:13632
resolvePromise @ angular-app.js:13326
(anonymous) @ angular-app.js:13426
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ angular-app.js:12936
onInvokeTask @ angular-app.js:82774
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ angular-app.js:12935
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ angular-app.js:12708
drainMicroTaskQueue @ angular-app.js:13114
Promise.then (async)
scheduleMicroTask @ angular-app.js:13097
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ angular-app.js:12926
onScheduleTask @ angular-app.js:12814
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ angular-app.js:12917
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ angular-app.js:12751
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask @ angular-app.js:12771
scheduleResolveOrReject @ angular-app.js:13413
resolvePromise @ angular-app.js:13359
(anonymous) @ angular-app.js:13275
Promise.then (async)
(anonymous) @ angular-app.js:13633
ZoneAwarePromise @ angular-app.js:13444
Ctor.then @ angular-app.js:13632
(anonymous) @ angular-app.js:18557
fetch @ angular-app.js:18538
_fetchData @ angular-app.js:18840
(anonymous) @ angular-app.js:18805
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ angular-app.js:12904
onInvoke @ angular-app.js:82783
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ angular-app.js:12903
push../node_modules/zone.js/dist/zone.js.Zone.run @ angular-app.js:12663
(anonymous) @ angular-app.js:13423
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ angular-app.js:12936
onInvokeTask @ angular-app.js:82774
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ angular-app.js:12935
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ angular-app.js:12708
drainMicroTaskQueue @ angular-app.js:13114
Promise.then (async)
scheduleMicroTask @ angular-app.js:13097
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ angular-app.js:12926
onScheduleTask @ angular-app.js:12814
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ angular-app.js:12917
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ angular-app.js:12751
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask @ angular-app.js:12771
scheduleResolveOrReject @ angular-app.js:13413
resolvePromise @ angular-app.js:13359
(anonymous) @ angular-app.js:13275
Promise.then (async)
(anonymous) @ angular-app.js:13633
ZoneAwarePromise @ angular-app.js:13444
Ctor.then @ angular-app.js:13632
resolvePromise @ angular-app.js:13326
(anonymous) @ angular-app.js:13426
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ angular-app.js:12936
onInvokeTask @ angular-app.js:82774
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ angular-app.js:12935
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ angular-app.js:12708
drainMicroTaskQueue @ angular-app.js:13114
Promise.then (async)
scheduleMicroTask @ angular-app.js:13097
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ angular-app.js:12926
onScheduleTask @ angular-app.js:12814
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ angular-app.js:12917
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ angular-app.js:12751
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask @ angular-app.js:12771
scheduleResolveOrReject @ angular-app.js:13413
resolvePromise @ angular-app.js:13359
(anonymous) @ angular-app.js:13275
Promise.then (async)
(anonymous) @ angular-app.js:13633
ZoneAwarePromise @ angular-app.js:13444
Ctor.then @ angular-app.js:13632
(anonymous) @ angular-app.js:18557
fetch @ angular-app.js:18538
_fetchData @ angular-app.js:18840
(anonymous) @ angular-app.js:18800
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ angular-app.js:12904
onInvoke @ angular-app.js:82783
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke @ angular-app.js:12903
push../node_modules/zone.js/dist/zone.js.Zone.run @ angular-app.js:12663
(anonymous) @ angular-app.js:13423
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ angular-app.js:12936
onInvokeTask @ angular-app.js:82774
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ angular-app.js:12935
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ angular-app.js:12708
drainMicroTaskQueue @ angular-app.js:13114
Promise.then (async)
scheduleMicroTask @ angular-app.js:13097
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ angular-app.js:12926
push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask @ angular-app.js:12751
push../node_modules/zone.js/dist/zone.js.Zone.scheduleMicroTask @ angular-app.js:12771
scheduleResolveOrReject @ angular-app.js:13413
ZoneAwarePromise.then @ angular-app.js:13553
push../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModule @ angular-app.js:83316
./src/main.ts @ angular-app.js:346
webpack_require @ angular-app.js:16158
0 @ angular-app.js:359
webpack_require @ angular-app.js:16158
checkDeferredModules @ angular-app.js:16124
webpackJsonpCallback @ angular-app.js:16111
(anonymous) @ angular-app.js:16800

@vml-chrisfisher
Copy link

Getting the same error on the react side. @GirishBB did you find a solution?

@godanny86
Copy link
Collaborator

hi @buffaloproject1 can you check your developer tools to see if the XHR call to .model.json is resolving correctly?

@vml-chrisfisher
Copy link

We are implementing the SSR version. This happens on the app template json that is returned. Though the code is failing in the cq-spa-page-model-manager.js. It is doing a split on the path string, which doesn't have jcr:content in it. So the getNodeName function fails when it does lastIndexOf

@godanny86
Copy link
Collaborator

ah I didn't realize you were implemeting SSR. It might be worthwhile to checkout the We.Retail Journal project which has SSR working... (while this project does not..)
https://github.com/adobe/aem-sample-we-retail-journal/blob/master/react-app/DEVELOPMENT.md

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