damienbod / angular-auth-oidc-client

npm package for OpenID Connect, OAuth Code Flow with PKCE, Refresh tokens, Implicit Flow
https://www.npmjs.com/package/angular-auth-oidc-client
MIT License
1.15k stars 433 forks source link

"An error was thrown in afterAll: TypeError: Cannot destructure property 'configId' of 'configuration' as it is undefined." #1869

Closed arshad827 closed 10 months ago

arshad827 commented 11 months ago

Version

14.1.5

An error was thrown in afterAll
  TypeError: Cannot destructure property 'configId' of 'configuration' as it is undefined.
      at LoggerService.logError (http://localhost:9876/_karma_webpack_/webpack:/node_modules/angular-auth-oidc-client/fesm2020/angular-auth-oidc-client.mjs:115:17)      at forEach (http://localhost:9876/_karma_webpack_/webpack:/node_modules/angular-auth-oidc-client/fesm2020/angular-auth-oidc-client.mjs:3617:66)
      at Array.forEach (<anonymous>)
      at ConfigValidationService.processValidationResultsAndGetErrorCount (http://localhost:9876/_karma_webpack_/webpack:/node_modules/angular-auth-oidc-client/fesm2020/angular-auth-oidc-client.mjs:3617:26)
      at forEach (http://localhost:9876/_karma_webpack_/webpack:/node_modules/angular-auth-oidc-client/fesm2020/angular-auth-oidc-client.mjs:3603:37)
      at Array.forEach (<anonymous>)
      at ConfigValidationService.validateConfigsInternal (http://localhost:9876/_karma_webpack_/webpack:/node_modules/angular-auth-oidc-client/fesm2020/angular-auth-oidc-client.mjs:3602:23)
      at ConfigValidationService.validateConfigs (http://localhost:9876/_karma_webpack_/webpack:/node_modules/angular-auth-oidc-client/fesm2020/angular-auth-oidc-client.mjs:3594:21)
      at ConfigurationService.prepareAndSaveConfigs (http://localhost:9876/_karma_webpack_/webpack:/node_modules/angular-auth-oidc-client/fesm2020/angular-auth-oidc-client.mjs:3732:43)
      at http://localhost:9876/_karma_webpack_/webpack:/node_modules/angular-auth-oidc-client/fesm2020/angular-auth-oidc-client.mjs:3706:7

Steps to reproduce the behavior

run test - ng test --karma-config karma.conf.ci.js --code-coverage --browsers=ChromeHeadless --reporters=progress,junit

Angular version 14

A clear and concise description of what you expected to happen.

After upgrading to version "^14.1.0" of "angular-auth-oidc-client," an error occurs during the execution of ng test. The error message is as follows:

"An error was thrown in afterAll: TypeError: Cannot destructure property 'configId' of 'configuration' as it is undefined."

"dependencies": {
    "@angular-eslint/schematics": "^1.0.0",
    "@angular/animations": "^14.3.0",
    "@angular/cdk": "^14.0.0",
    "@angular/common": "^14.3.0",
    "@angular/compiler": "^14.3.0",
    "@angular/core": "^14.3.0",
    "@angular/forms": "^14.3.0",
    "@angular/material": "^14.1.0",
    "@angular/platform-browser": "^14.3.0",
    "@angular/platform-browser-dynamic": "^14.3.0",
    "@angular/router": "^14.3.0",
    "@asymmetrik/ngx-leaflet": "^8.1.0",
    "@azure/storage-blob": "^12.2.1",
    "@circlon/angular-tree-component": "^11.0.4",
    "@types/file-saver": "^2.0.2",
    "angular-auth-oidc-client": "^14.1.0",
    "angular-google-charts": "latest",
    "angular-oauth2-oidc": "^14.0.0",
    "buffer": "^5.6.0",
    "express": "^4.18.0",
    "file-saver": "^2.0.5",
    "jwt-decode": "^3.1.2",
    "leaflet": "^1.9.0",
    "leaflet-simple-map-screenshoter": "^0.4.5",
    "mdb-angular-ui-kit": "^3.0.0",
    "ng-openapi-gen": "^0.50.0",
    "ngx-json-viewer": "^3.0.2",
    "ngx-mat-select-search": "^4.0.1",
    "ngx-toastr": "~12.1.0",
    "papaparse": "^5.3.1",
    "puppeteer": "^21.3.0",
    "rxjs": ">7.0.0",
    "tslib": "^2.6.2",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.2.13",
    "@angular/cli": "^14.2.13",
    "@angular/compiler-cli": "^14.3.0",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/leaflet": "^1.7.5",
    "@types/node": "^12.11.1",
    "@types/plotly.js-dist-min": "^2.3.0",
    "codelyzer": "^6.0.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "^2.0.3",
    "karma-jasmine-html-reporter": "^2.0.0",
    "karma-junit-reporter": "^1.2.0",
    "ng-mocks": "^14.0.0",
    "ng-swagger-gen": "^2.3.1",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.6.4"
  }

Additional context

No response

lufo88ita commented 11 months ago

Happens also to me in Angular 16 with library version 16.0.1.

steve-allan commented 10 months ago

I have the same problem but only when the app has been deployed to a QA environment. Locally everything works as expected. In my case, I get the error when calling isAuthenticated or checkAuth. I'm thinking it's a configuration issue but I've only just started to track it down.

EDIT: It was a configuration issue, the config wasn't getting added to the environment. Once I was making sure all the required values were existing the problem went away.

will-hu-0 commented 10 months ago

Why this is closed? I suppose the issue is still there..