Search code examples
angularokta

Error Using Okta: "ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(n)[ET -> ET -> ET]"


I'm encountering the following error during runtime:

main.js:1 ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(n)[ET -> ET -> ET]: 
  NullInjectorError: No provider for ET!
NullInjectorError: R3InjectorError(n)[ET -> ET -> ET]: 
  NullInjectorError: No provider for ET!

I'm following the configuration steps provided in okta-angular and below is my app.module.ts:

import { OktaAuthModule, OktaConfig, OKTA_CONFIG } from '@okta/okta-angular';
import { OktaAuth } from '@okta/okta-auth-js';

const oktaAuth = new OktaAuth(environment.myConfig);
const moduleConfig: OktaConfig = { oktaAuth };

@NgModule({
    declarations: [
    ],
    imports: [
        OktaAuthModule.forRoot(moduleConfig),
    ],
    providers: [
    ],
    bootstrap: [
        AppComponent
    ],
    schemas: [
    ]
})
export class AppModule { }
"@angular/core": "^15.2.9",
"@ng-bootstrap/ng-bootstrap": "^6.0.0",
"@okta/okta-angular": "^6.2.0",
"@okta/okta-auth-js": "^7.2.0",

Most similar questions example have been resolved by declaring the custom service in the "imports" section or listing the service under the providers section of their app.module.ts however I haven't found those solutions to be the case for me. In the documentation, the forRoot() method is the recommended usage anyways while the providers method is apparently deprecated.

I also can't seem to narrow down what "ET" refers to even though this is a normal local build with optimization off. Posts will similar errors usually specify the custom-module/service that's causing the error but mine seems to be obfuscated?

Any help would be appreciated.


Solution

  • You need to add the name of the service to the app.module providers array.