[keycloak-user] Angular 2 with Webpack

Brian Schofield scope022 at gmail.com
Mon Jan 30 15:09:23 EST 2017


All I can say right now is errors and more errors :(

The charAt issue was coming from the login function, I have removed that
for now.  What I'm seeing in console is as shown below (sorry for the long
trace).

Do note that I am getting console out that says 'initializing Keycloak
method' however it's seems that the request for the keycloak.json is
returning html.

Any ideas?


initializing Keycloak method
VM1237:3521 EXCEPTION: Unexpected token < in JSON at position 0
ErrorHandler.handleError @ VM1237:3521
next @ VM1237:8529
schedulerFn @ VM1237:4138
SafeSubscriber.__tryOrUnsub @ VM1242:223
SafeSubscriber.next @ VM1242:172
Subscriber._next @ VM1242:125
Subscriber.next @ VM1242:89
Subject.next @ VM1238:55
EventEmitter.emit @ VM1237:4124
NgZone.triggerError @ VM1237:4487
onHandleError @ VM1237:4448
ZoneDelegate.handleError @ VM1217:246
Zone.runTask @ VM1217:154
ZoneTask.invoke @ VM1217:345
VM1237:3526 ORIGINAL STACKTRACE:
ErrorHandler.handleError @ VM1237:3526
next @ VM1237:8529
schedulerFn @ VM1237:4138
SafeSubscriber.__tryOrUnsub @ VM1242:223
SafeSubscriber.next @ VM1242:172
Subscriber._next @ VM1242:125
Subscriber.next @ VM1242:89
Subject.next @ VM1238:55
EventEmitter.emit @ VM1237:4124
NgZone.triggerError @ VM1237:4487
onHandleError @ VM1237:4448
ZoneDelegate.handleError @ VM1217:246
Zone.runTask @ VM1217:154
ZoneTask.invoke @ VM1217:345
VM1237:3527 SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Response.Body.json (eval at <anonymous> (
http://localhost:3000/vendor.js:145:2), <anonymous>:777:29)
    at MapSubscriber.eval [as project] (eval at <anonymous> (
http://localhost:3000/app.js:1210:2), <anonymous>:424:75)
    at MapSubscriber._next (eval at <anonymous> (
http://localhost:3000/vendor.js:496:2), <anonymous>:77:35)
    at MapSubscriber.Subscriber.next (eval at <anonymous> (
http://localhost:3000/vendor.js:54:2), <anonymous>:89:18)
    at XMLHttpRequest.onLoad (eval at <anonymous> (
http://localhost:3000/vendor.js:145:2), <anonymous>:1180:42)
    at ZoneDelegate.invokeTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:275:35)
    at Object.onInvokeTask (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:4418:41)
    at ZoneDelegate.invokeTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:274:40)
    at Zone.runTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:151:47)
    at XMLHttpRequest.ZoneTask.invoke (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:345:33)
  -------------   Elapsed: 75 ms; At: Mon Jan 30 2017 14:04:39 GMT-0600
(CST)   -------------
    at getStacktraceWithUncaughtError (eval at <anonymous> (
http://localhost:3000/polyfills.js:2258:2), <anonymous>:33:12) [angular]
    at new LongStackTrace (eval at <anonymous> (
http://localhost:3000/polyfills.js:2258:2), <anonymous>:27:22) [angular]
    at Object.onScheduleTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2258:2), <anonymous>:83:18) [angular]
    at ZoneDelegate.scheduleTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:252:49) [angular]
    at Zone.scheduleEventTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:171:39) [angular]
    at zoneAwareAddListener (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:1226:14) [angular]
    at XMLHttpRequest.addEventListener (eval at createNamedFn (eval at
<anonymous> (http://localhost:3000/polyfills.js:2252:2)), <anonymous>:3:43)
[angular]
    at Observable.eval [as _subscribe] (eval at <anonymous> (
http://localhost:3000/vendor.js:145:2), <anonymous>:1227:22) [angular]
    at Observable.subscribe (eval at <anonymous> (
http://localhost:3000/vendor.js:36:2), <anonymous>:45:27) [angular]
    at MapOperator.call (eval at <anonymous> (
http://localhost:3000/vendor.js:496:2), <anonymous>:54:23) [angular]
    at Observable.subscribe (eval at <anonymous> (
http://localhost:3000/vendor.js:36:2), <anonymous>:42:22) [angular]
    at Observable.eval [as _subscribe] (eval at <anonymous> (
http://localhost:3000/app.js:1210:2), <anonymous>:424:86) [angular]
    at Observable.subscribe (eval at <anonymous> (
http://localhost:3000/vendor.js:36:2), <anonymous>:45:27) [angular]
    at Keycloak.init (eval at <anonymous> (
http://localhost:3000/app.js:1210:2), <anonymous>:405:44) [angular]
    at AppComponent.ngOnInit (eval at <anonymous> (
http://localhost:3000/app.js:1186:2), <anonymous>:34:23) [angular]
    at Wrapper_AppComponent.ngDoCheck
(/AppModule/AppComponent/wrapper.ngfactory.js:22:53) [angular]
    at
CompiledTemplate.proxyViewClass.View_AppComponent_Host0.detectChangesInternal
(/AppModule/AppComponent/host.ngfactory.js:28:26) [angular]
    at CompiledTemplate.proxyViewClass.AppView.detectChanges (eval at
<anonymous> (http://localhost:3000/vendor.js:24:2), <anonymous>:12738:18)
[angular]
    at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (eval at
<anonymous> (http://localhost:3000/vendor.js:24:2), <anonymous>:12885:48)
[angular]
    at ViewRef_.detectChanges (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:9907:24) [angular]
    at eval (eval at <anonymous> (http://localhost:3000/vendor.js:24:2),
<anonymous>:8797:71) [angular]
    at Array.forEach (native) [angular]
    at ApplicationRef_.tick (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:8797:29) [angular]
    at ApplicationRef_._loadComponent (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:8772:18) [angular]
    at ApplicationRef_.bootstrap (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:8760:18) [angular]
    at eval (eval at <anonymous> (http://localhost:3000/vendor.js:24:2),
<anonymous>:8581:93) [angular]
    at Array.forEach (native) [angular]
    at PlatformRef_._moduleDoBootstrap (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:8581:46) [angular]
    at eval (eval at <anonymous> (http://localhost:3000/vendor.js:24:2),
<anonymous>:8533:31) [angular]
    at Object.onInvoke (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:4427:41) [angular]
    at Zone.run (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:113:43) [angular =>
angular]
    at eval (eval at <anonymous> (http://localhost:3000/polyfills.js:2252:2),
<anonymous>:535:57) [angular]
    at Object.onInvokeTask (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:4418:41) [angular]
    at ZoneDelegate.invokeTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:274:40) [angular]
    at Zone.runTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:151:47) [<root> =>
angular]
    at drainMicroTaskQueue (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:433:35) [<root>]
  -------------   Elapsed: 114 ms; At: Mon Jan 30 2017 14:04:38 GMT-0600
(CST)   -------------
    at getStacktraceWithUncaughtError (eval at <anonymous> (
http://localhost:3000/polyfills.js:2258:2), <anonymous>:33:12) [angular]
    at new LongStackTrace (eval at <anonymous> (
http://localhost:3000/polyfills.js:2258:2), <anonymous>:27:22) [angular]
    at Object.onScheduleTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2258:2), <anonymous>:83:18) [angular]
    at ZoneDelegate.scheduleTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:252:49) [angular]
    at Zone.scheduleMicroTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:165:39) [angular]
    at scheduleResolveOrReject (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:533:14) [angular]
    at resolvePromise (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:496:21) [angular]
    at eval (eval at <anonymous> (http://localhost:3000/polyfills.js:2252:2),
<anonymous>:535:17) [angular]
    at Object.onInvokeTask (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:4418:41) [angular]
    at ZoneDelegate.invokeTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:274:40) [angular]
    at Zone.runTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:151:47) [<root> =>
angular]
    at drainMicroTaskQueue (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:433:35) [<root>]
  -------------   Elapsed: 7 ms; At: Mon Jan 30 2017 14:04:38 GMT-0600
(CST)   -------------
    at getStacktraceWithUncaughtError (eval at <anonymous> (
http://localhost:3000/polyfills.js:2258:2), <anonymous>:33:12) [angular]
    at new LongStackTrace (eval at <anonymous> (
http://localhost:3000/polyfills.js:2258:2), <anonymous>:27:22) [angular]
    at Object.onScheduleTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2258:2), <anonymous>:83:18) [angular]
    at ZoneDelegate.scheduleTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:252:49) [angular]
    at Zone.scheduleMicroTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:165:39) [angular]
    at scheduleResolveOrReject (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:533:14) [angular]
    at ZoneAwarePromise.then (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:622:17) [angular]
    at new ApplicationInitStatus (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:3791:64) [angular]
    at AppModuleInjector.createInternal
(/AppModule/module.ngfactory.js:323:36) [angular]
    at AppModuleInjector.NgModuleInjector.create (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:8979:80) [angular]
    at NgModuleFactory.create (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:8953:22) [angular]
    at eval (eval at <anonymous> (http://localhost:3000/vendor.js:24:2),
<anonymous>:8523:65) [angular]
    at Object.onInvoke (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:4427:41) [angular]
    at Zone.run (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:113:43) [<root> =>
angular]
    at NgZone.run (eval at <anonymous> (http://localhost:3000/vendor.js:24:2),
<anonymous>:4296:66) [<root>]
    at PlatformRef_._bootstrapModuleFactoryWithZone (eval at <anonymous> (
http://localhost:3000/vendor.js:24:2), <anonymous>:8521:27) [<root>]
    at eval (eval at <anonymous> (http://localhost:3000/vendor.js:24:2),
<anonymous>:8572:63) [<root>]
    at Zone.run (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:113:43) [<root> =>
<root>]
    at eval (eval at <anonymous> (http://localhost:3000/polyfills.js:2252:2),
<anonymous>:535:57) [<root>]
    at Zone.runTask (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:151:47) [<root> =>
<root>]
    at drainMicroTaskQueue (eval at <anonymous> (
http://localhost:3000/polyfills.js:2252:2), <anonymous>:433:35) [<root>]

On Mon, Jan 30, 2017 at 1:18 PM, ebondu <dev.ebondu at gmail.com> wrote:

> It seems the realm field url is not loaded correctly from your
> keycloak.json.
> Can you check the realm field from your keycloak.json or share it? If the
> file is OK, check if it is accessible from your browser at
> http://localhost:8080/keycloak.json
>
>
>
> --
> View this message in context: http://keycloak-user.88327.x6.
> nabble.com/keycloak-user-Angular-2-with-Webpack-tp2493p2527.html
> Sent from the keycloak-user mailing list archive at Nabble.com.
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>



-- 
Brian §chofield


More information about the keycloak-user mailing list