Angular-auth-oidc-client: Build error using v11.0.0 in Angular 9 library

Created on 6 May 2020  Â·  6Comments  Â·  Source: damienbod/angular-auth-oidc-client

Describe the bug
Unable to build Angular library after upgrading angular-auth-oidc-client to version 11.

ERROR: Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
Can't resolve all parameters for ɵc in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?).
Can't resolve all parameters for OidcSecurityService in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?, ?, [object Object], [object Object], [object Object], [object Object], ?, [object Object], ?, [object Object], [object Object], [object Object], [object Object], [object Object], ?).
Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
Can't resolve all parameters for ɵbb in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?, [object Object], [object Object], [object Object], ?, ?).
Can't resolve all parameters for ɵp in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?, [object Object]).
Can't resolve all parameters for ɵr in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?, [object Object], [object Object], [object Object], [object Object], [object Object], [object Object], [object Object], [object Object], [object Object]).
Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
Can't resolve all parameters for ɵy in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: ([object Object], ?, [object Object], ?, ?, [object Object], ?).
Can't resolve all parameters for ɵg in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: ([object Object], ?, ?, [object Object], [object Object], ?, [object Object]).
Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
Can't resolve all parameters for ɵo in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?, [object Object], ?, ?, [object Object]).
Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
Can't resolve all parameters for ɵt in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?, [object Object], [object Object], [object Object], ?, [object Object]).
Invalid provider for undefined. useClass cannot be undefined.
Usually it happens when:
1. There's a circular dependency (might be caused by using index.ts (barrel) files).
2. Class was used before it was declared. Use forwardRef in this case.

An unhandled exception occurred: Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
Can't resolve all parameters for ɵc in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?).
Can't resolve all parameters for OidcSecurityService in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?, ?, [object Object], [object Object], [object Object], [object Object], ?, [object Object], ?, [object Object], [object Object], [object Object], [object Object], [object Object], ?).
Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
Can't resolve all parameters for ɵbb in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?, [object Object], [object Object], [object Object], ?, ?).
Can't resolve all parameters for ɵp in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?, [object Object]).
Can't resolve all parameters for ɵr in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?, [object Object], [object Object], [object Object], [object Object], [object Object], [object Object], [object Object], [object Object], [object Object]).
Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
Can't resolve all parameters for ɵy in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: ([object Object], ?, [object Object], ?, ?, [object Object], ?).
Can't resolve all parameters for ɵg in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: ([object Object], ?, ?, [object Object], [object Object], ?, [object Object]).
Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
Can't resolve all parameters for ɵo in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?, [object Object], ?, ?, [object Object]).
Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.
Can't resolve all parameters for ɵt in D:/Dev/TestProjects/oidc-client-lib-test/node_modules/angular-auth-oidc-client/angular-auth-oidc-client.d.ts: (?, [object Object], [object Object], [object Object], ?, [object Object]).
Invalid provider for undefined. useClass cannot be undefined.
Usually it happens when:
1. There's a circular dependency (might be caused by using index.ts (barrel) files).
2. Class was used before it was declared. Use forwardRef in this case.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Angular project - ng new oidc-client-lib-test
  2. Create a library - ng g library oidc-lib
  3. Install angular-auth-oidc-client and import any type from angular-auth-oidc-client in oidc-lib.module.ts (it would be enough to see warning)
  4. Add AuthModule.forRoot() in NgModule imports (it would lead to actual error)
  5. Build library in production mode - ng build oidc-lib --prod
  6. See error

Expected behavior
Build Angular library without any errors as it worked in v10.0.15

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome

Most helpful comment

We are currently working on a fix. Going to push it out asap. Thanks.

All 6 comments

Hey @csharpexpert thanks. So to be clear. You are using the angular-oidc-lib in another lib which you do lazy load or not lazy load? Thanks :) Will try to reproduce tomorrow.

Not lazy load. I created a new project from scratch exactly in steps I described. No code except importing angular-auth-oidc-client and adding AuthModule.forRoot() to NgModule. Angular project doesn't even have any reference to this library.

Our project also seems to suffer from an error like this one.

However in our case it happens with our main angular app, not a project.
In our case it also only happens when we run xliffmerge from the @ngx-i18nsupport/ngx-i18nsupport package. The normal ng build seems to work fine.

My assumption is that with the default builder, angular-auth-oidc-client seems to work fine. But with special builders like the one used in xliffmerge and projects there's something odd happening.

We are currently working on a fix. Going to push it out asap. Thanks.

We just published a new version 11.0.1 with the fix, so you might try that out. We could reproduce the issue with the steps you provided and in our tests the problem is fixed now.

Build works, thank you.

Was this page helpful?
0 / 5 - 0 ratings