Hi, I have the same issue, but a workaround for this is installing @azure/msal-react 2.0.2 and the build will work like normal. Cheers.
How to fix Uncaught TypeError: window.crypto.randomUUID is not a function in react JS app using MSAL after deploying it in IIS
After deploying the React js application which uses Single sign on process using MSAL library, the following error occurs in IIS.
Uncaught TypeError: window.crypto.randomUUID is not a function
at d.value (CryptoOps.ts:70:5)
at e.value (EventHandler.ts:64:5)
at A.value (StandardController.ts:1801:5)
at o.value (PublicClientApplication.ts:167:5)
at MsalProvider.tsx:88:37
at ol (react-dom.production.min.js:244:332)
at Cc (react-dom.production.min.js:286:111)
at react-dom.production.min.js:282:391
at _ (scheduler.production.min.js:13:203)
at MessagePort.R (scheduler.production.min.js:14:128)
4 answers
Sort by: Most helpful
-
-
Raman Zhukouski 0 Reputation points
2023-10-10T16:21:49.12+00:00 I have the same issue, but only on Android using client app
-
Bruce (SqlWork.com) 69,276 Reputation points
2023-12-19T21:23:55.24+00:00 this is a missing browser method. you must be using an old browser, just add a polyfill:
-
Ben Gunnewijk 0 Reputation points
2023-12-20T12:42:44.65+00:00 Okay I know what caused the error for me.
window.crypto.randomUUID
is only available under HTTPS context: https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUIDMy website was being deployed to a linux server without domain name or certificate. And thus on localhost the crypto functions were loaded but on the http website they never get loaded, not even with the crypto-randomuuid polyfill.
Found this in a similar issue on the parcel bundler:
https://github.com/parcel-bundler/parcel/issues/8820