Auth0 Home Blog Docs

[RESOLVED] TypeError, 'digest' of undefined, in some environments

Hi.

We’ve just implemented Auth0 for our SPA Angular project.

When we’re running the build locally using ng serve it seems to function 100% properly, how-ever, after our CD and in our staging environment, the authentication seems broken, and the console showsthis error:

TypeError: Cannot read property 'digest' of undefined
    at N (auth0-spa-js.production.js:1)
    at ie.<anonymous> (auth0-spa-js.production.js:1)
    at Generator.next (<anonymous>)
    at auth0-spa-js.production.js:1
    at new ZoneAwarePromise (zone-evergreen.js:876)
    at t (auth0-spa-js.production.js:1)
    at ie.loginWithRedirect (auth0-spa-js.production.js:1)
    at AuthGuard.<anonymous> (auth.guard.ts:22)
    at Generator.next (<anonymous>)
    at fulfilled (environment.ts:11)
    at resolvePromise (zone-evergreen.js:797)
    at new ZoneAwarePromise (zone-evergreen.js:879)
    at t (auth0-spa-js.production.js:1)
    at ie.loginWithRedirect (auth0-spa-js.production.js:1)
    at AuthGuard.<anonymous> (auth.guard.ts:22)
    at Generator.next (<anonymous>)
    at fulfilled (environment.ts:11)
    at ZoneDelegate.invoke (zone-evergreen.js:359)
    at Object.onInvoke (core.js:34195)
    at ZoneDelegate.invoke (zone-evergreen.js:358)

Anyone got any good ideas for what can be causing this?

Our staging has these flags enabled in the angular.json environment configuration:

"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true

Just referencing similar threads in the forum:

btw: Does your staging environment run on http or https?

Okay, yes, the issue was because it was running over HTTP rather than HTTPS. Thanks :smiley:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.