Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Okta angular can’t compile with “ng build –prod” #72

Closed
1 of 3 tasks
DavidAaronOrtiz opened this issue Oct 6, 2021 · 10 comments
Closed
1 of 3 tasks

Okta angular can’t compile with “ng build –prod” #72

DavidAaronOrtiz opened this issue Oct 6, 2021 · 10 comments

Comments

@DavidAaronOrtiz
Copy link

I'm submitting a:

  • Bug report
  • Feature request
  • Other (Describe below)

Current behavior

Running "ng build --prod" causes the following error:
ERROR in Can’t resolve all parameters for OktaAuthGuard in //node_modules/@okta/okta-angular/okta-angular.d.ts: ([object Object], ?, [object Object]).
Can’t resolve all parameters for OktaAuthStateService in //node_modules/@okta/okta-angular/okta-angular.d.ts: (?).
Can’t resolve all parameters for OktaCallbackComponent in //node_modules/@okta/okta-angular/okta-angular.d.ts: ([object Object], ?, [object Object]).
Can’t resolve all parameters for LoginPage in //src/app/pages/login/login.page.ts: ([object Object], [object Object], [object Object], [object Object], [object Object], [object Object], [object Object], [object Object], [object Object], [object Object], ?).

Expected behavior

Application will compile correctly

Minimal reproduction of the problem with instructions

Run "ng build --prod"

Extra information about the use case/user story you are trying to implement

"ng serve" compiles. Already added skipLibCheck in the tsconfig.

Environment

  • Package version:
    "@okta/okta-angular": 4.1.0
    "@okta/okta-auth-js": 5.5.0
  • Angular version: 8.2.14
  • Browser: any
  • OS: macOS Mojave 10.14.6
  • Node version (node -v): 10.16.3
  • Other:

Configuration

  • Okta application type: SPA
@oleksandrpravosudko-okta
Copy link
Contributor

Thanks for report @DavidAaronOrtiz.
Internal Ref: OKTA-435165

@shuowu
Copy link
Contributor

shuowu commented Oct 6, 2021

@DavidAaronOrtiz It's probably because of the typescript version from Angular 8 cannot compatible with types in the newly published version. Can you try upgrade the angular version or use older version of okta-angular as a workaround?

Also, here is our angular samples repo, I just verified the build script works well there.

@shuowu
Copy link
Contributor

shuowu commented Nov 4, 2021

@DavidAaronOrtiz The issue should be fixed in version 4.1.1

Closing this issue, feel free to reopen it if the problem still exist.

@shuowu shuowu closed this as completed Nov 4, 2021
@gvdmierop
Copy link

@shuowu
I'm experiencing the following error running 'ng build --prod' using version 4.1.1 on an Angular 7 project.

Can’t resolve all parameters for OktaCallbackComponent in //node_modules/@okta/okta-angular/okta-angular.d.ts: ([object Object], ?, [object Object]).

It's also one of the errors mentioned by @DavidAaronOrtiz so I think this issue is not entirely fixed in version 4.1.1.

Can you look into this again, please?
In the meanwhile I'll try to downgrade the okta-angular version to get around this.

@yamanch123
Copy link

yamanch123 commented Nov 16, 2021

@shuowu
getting the same error using version 4.1.1 on an Angular 8 project.
Can't resolve all parameters for OktaAuthGuard in //node_modules/@okta/okta-angular/okta-angular.d.ts: ([object Object], ?, [object Object]).
: Can't resolve all parameters for OktaAuthStateService in //node_modules/@okta/okta-angular/okta-angular.d.ts: (?).
: Can't resolve all parameters for OktaCallbackComponent in //node_modules/@okta/okta-angular/okta-angular.d.ts: ([object Object], ?, [object Object]).

@shuowu shuowu reopened this Nov 16, 2021
@gvdmierop
Copy link

@shuowu I'm experiencing the following error running 'ng build --prod' using version 4.1.1 on an Angular 7 project.

Can’t resolve all parameters for OktaCallbackComponent in //node_modules/@okta/okta-angular/okta-angular.d.ts: ([object Object], ?, [object Object]).

It's also one of the errors mentioned by @DavidAaronOrtiz so I think this issue is not entirely fixed in version 4.1.1.

Can you look into this again, please? In the meanwhile I'll try to downgrade the okta-angular version to get around this.

Downgrading to 3.2.2 fixed it for now.

@gvdmierop
Copy link

@shuowu I'm experiencing the following error running 'ng build --prod' using version 4.1.1 on an Angular 7 project.
Can’t resolve all parameters for OktaCallbackComponent in //node_modules/@okta/okta-angular/okta-angular.d.ts: ([object Object], ?, [object Object]).
It's also one of the errors mentioned by @DavidAaronOrtiz so I think this issue is not entirely fixed in version 4.1.1.
Can you look into this again, please? In the meanwhile I'll try to downgrade the okta-angular version to get around this.

Downgrading to 3.2.2 fixed it for now.

Unfortunately, I had to downgrade to 2.1.0.
3.2.2 version was built succesfully, but at runtime it gave me the error 'Uncaught TypeError: Super expression must either be null or a function'

Still, I would like to use a more recent version, as version 2.1.0 does not work with refresh token mechanisms yet.

Any news on a possible fix for this?

Thank you.

@shuowu
Copy link
Contributor

shuowu commented Nov 29, 2021

@gvdmierop @yamanch123 @DavidAaronOrtiz A fix PR is created here, can you verify against that PR branch to see if the fix works? (The PR is a bit verbose, since we want to create test apps cross different versions to verify the code change.)

@gvdmierop
Copy link

gvdmierop commented Nov 30, 2021

@shuowu ,

The fix PR seems to be the fix for building with 'ng build --prod' on our Angular 7 app!
Note that I had to add @Inject(OKTA_AUTH) to every component where we inject an OktaAuth instance:

@Inject(OKTA_AUTH) private oktaAuth: OktaAuth

Thank you for your help.

However, at runtime I still get the same error I also had with version 3.2.2: 'Uncaught TypeError: Super expression must either be null or a function'.
This is only a problem when the 'optimization' flag is set to true in the angular.json file.
Not sure if this is related to the okta-angular library or the okta-auth-js library.

Could you help me on with this one?

@shuowu
Copy link
Contributor

shuowu commented Dec 1, 2021

The fix went out in v5.0 since it introduces breaking change. Closing this issue, feel free to re-open if you are still seeing the issue in v5.

@shuowu shuowu closed this as completed Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants