I’m using Auth0 with an Angular SPA (Single Page Application) using the (recommended) hosted login approach.
Since today, when calling the this.auth0.parseHash method it would throw me an error: "Authorization Extension: Compilation failed: Cannot find module auth0-extension-hapi-tools@1.2.2’“. I tried different commits that worked before as well as different logins, but with none of them worked. I also tried to install the npm package auth0-extension-hapi-tools@1.2.2’”` which didn’t help neither.
Why is this happening and how can I solve it?
My auth code:
auth0 = new auth0.WebAuth({
clientID: AUTH_CONFIG.clientID,
domain: AUTH_CONFIG.domain,
responseType: 'token id_token',
audience: AUTH_CONFIG.apiUrl,
redirectUri: environment.AUTH0_CALLBACK_URI,
scope: this.requestedScopes
});
public handleAuthentication(): Observable<any> {
return Observable.create(observer => {
this.auth0.parseHash((err, authResult) => {
if (authResult && authResult.accessToken && authResult.idToken) {
window.location.hash = '';
this.setSession(authResult);
this.authenticationStateChanged.next(this.isAuthenticated());
this.router.navigate(['/home']);
if (!authResult.idTokenPayload || !authResult.idTokenPayload.name) {
throw new Error(
'Error while extracting the user name from authResult.idTokenPayload.name!'
);
}
observer.next(authResult.idTokenPayload.name);
} else if (err) {
this.router.navigate(['/home']);
console.log(err);
observer.next(false);
}
});
observer.next(undefined);
});
}
The below is my error which i am getting from today morning
“Authorization Extension: Compilation failed: Cannot find module ‘auth0-extension-hapi-tools@1.2.2’”. I am using Auth0-Authorisation extension and adding its claims into access_token.
We’ve just started seeing the following error when using Auth0.js (version 9.2.4) to login to our application using our EU tenant:
Authorization Extension: Compilation failed: Cannot find module ‘auth0-extension-hapi-tools@1.2.2’
We also see it when going to the Authorization extension from the dashboard.
Is there an issue on Auth0’s side with the Authorization extension?
I was wondering, if it could be due the node v4 support running out. So I upgraded to node v8 (for the auth0 rules), but it didn’t change anything so far, still the same error. Which node engine do u use?
As stated in the Github issue comment, the following solution for the issue is as follows:
To fix this issue perform the two following actions:
Migrate your Auth0 tenant from Node 4 to Node 8 and then republish the Auth0 rule that is created by the Authorization Extension. Here is the documentation page that explains how to migrate your tenant to Node 8.
After you have migrated to Node8, open the Authorization Extension in the dashboard. In the upper right-hand part of the page, you’ll see your tenant name. Click on your tenant name and select “Configuration” from the drop down menu. On the “Configuration” page, click the “Publish Rule” button. This will recreate your Auth0 rule to use the Node8 runtime.
I wanted to make sure I kept you in the loop on these recent events and if you have any additional questions on the matter please feel free to let us know. Thank you.