Uncaught errors logged to the console when not logged in
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [X] bug report
- [ ] feature request
When the app loads and you are not logged in, 3 errors are logged to the console.
If onLoad: 'check-sso'
is NOT included in keycloak options then the number of errors drops to only 1.
If you are already logged, in then no errors will be logged to the console.
Versions.
keycloak-angular: 2.0.2 angular: 5.2.2 keycloak: 4.1.0.Final
Repro steps.
Here’s the config and code I used.
import { APP_INITIALIZER } from '@angular/core';
import { KeycloakService, KeycloakOptions } from 'keycloak-angular';
import { environment } from '@taas/environments/environment';
const options: KeycloakOptions = {
config: {
url: environment.service.auth,
realm: environment.keycloak.realm,
clientId: environment.keycloak.clientId
},
initOptions: {
checkLoginIframe: true,
onLoad: 'check-sso', // this causes 2 of the errors
},
bearerPrefix: 'Bearer',
};
export function initializer(keycloakService: KeycloakService): () => Promise<boolean> {
return () => keycloakService.init(options)
.then(() => {
console.log('Security initialized');
return true;
})
.catch(err => { // I tried adding this to see if it would catch the errors but it doesn't.
console.error('Security not initialized:', err);
return false;
});
}
export const keycloakInitializer = {
provide: APP_INITIALIZER,
useFactory: initializer,
multi: true,
deps: [KeycloakService]
};
The log given by the failure.
These 3 errors are logged in the console.
ERROR Error: Uncaught (in promise): [object Undefined]
at resolvePromise (zone.js:814)
at resolvePromise (zone.js:771)
at eval (zone.js:873)
at ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:4751)
at ZoneDelegate.invokeTask (zone.js:420)
at Zone.runTask (zone.js:188)
at drainMicroTaskQueue (zone.js:595)
at ZoneTask.invokeTask [as invoke] (zone.js:500)
at invokeTask (zone.js:1540)
core.js:1449 ERROR Error: Uncaught (in promise): [object Undefined]
at resolvePromise (zone.js:814)
at resolvePromise (zone.js:771)
at eval (zone.js:873)
at ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:4751)
at ZoneDelegate.invokeTask (zone.js:420)
at Zone.runTask (zone.js:188)
at drainMicroTaskQueue (zone.js:595)
at ZoneTask.invokeTask [as invoke] (zone.js:500)
at invokeTask (zone.js:1540)
core.js:1449 ERROR Error: Uncaught (in promise): [object Undefined]
at resolvePromise (zone.js:814)
at Object.eval [as reject] (zone.js:724)
at Object.setError (keycloak.js:998)
at messageCallback (keycloak.js:1111)
at ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:4751)
at ZoneDelegate.invokeTask (zone.js:420)
at Zone.runTask (zone.js:188)
at ZoneTask.invokeTask [as invoke] (zone.js:496)
at invokeTask (zone.js:1540)
Desired functionality.
Desired functionality is that the errors are not logged to the console or have some way of handling them.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Console.log not working at all
The new code given throws two errors: Uncaught ReferenceError: fitHeight is not defined Uncaught TypeError: Cannot read property 'addEventListener' of null.
Read more >Uncaught errors in Node.js and the browser
This article looks into what happens with unhandled errors both in Node.js and in the browser.
Read more >Where are JavaScript Errors Logged?
This simple guide explains where JavaScript logs are located, how to configure logging, and why error monitoring tools like Rollbar make ...
Read more >Logging from Workers
The Workers platform captures all console.log 's and uncaught exceptions, in addition to information about the event itself. All of this can be ......
Read more >Fix JavaScript errors that are reported in the Console
A network error that starts with GET HTTP method followed by a URI. An Uncaught (in promise) TypeError: data.forEach is not a function...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have this problem with these versions: keycloak-angular: 4.0.0 angular: 6+
@GearoidSugrue and @mel1nn, I’m working on this issue.
On newer versions of Angular and keycloak-angular, the problem is not happening. Seems to be related to zone.js, however I’m still looking at it. If it is something related to keycloak-angular, I will release a bugfix on the next version 4.0.1. This is also the reason for the delay of 4.0.1, but I’m planning to release it in the middle of this week.
Thanks!