TypeError: _crypto.default.randomUUID is not a function being thrown when trying to connect through ios app

When I try to connect to expo through the ios app TypeError: _crypto.default.randomUUID is not a function being thrown

Hey @llynskey, are you using some UUID library? Also, want to clear are you running your project in Expo Go on an iOS device (I’m sorry, I didn’t understand it correctly).

Thank you for your reply but managed to fix the issue.

So it turns out in order to use the —tunnel option you need to have the eas cli installed and configured.

Once I did this I could connect successfully using the expo iOS app.

1 Like

Hi @llynskey – I encountered the same issue. Would you elaborate on what worked for you? Thanks!

@haochencrypto I had the same issue and the problem was the old node version which I was using.
The error is that the crypto.randomUUID function was added for Node versions > v14.17.0

Updating the node version fixed my issue. :slightly_smiling_face:

1 Like

Hey y’all, I too have encountered this issue when running npx expo start in a brand new project. I updated my node to v19.6.1 and installed the eas cli, but am still getting this same error. What configuration steps did you take @ilynskey?

I’m having a problem with the expo-crypto module on Google Chrome for Android (Android v13 on OnePlus 9RT / Chrome 112.0.5615.48). Works fine on Chrome desktop (macOS) browser.
caught TypeError: getCrypto(...).randomUUID is not a function at Object.randomUUID (ExpoCrypto.web.ts:44:1) at Module.randomUUID (Crypto.ts:178:1) at CreateDice (Main.jsx:28:1) at Main.jsx:31:1 at Array.map (<anonymous>) at GenerateNewDices (Main.jsx:31:1) at Main (Main.jsx:43:1) at renderWithHooks (react-dom.development.js:16305:1) at mountIndeterminateComponent (react-dom.development.js:20074:1) at beginWork (react-dom.development.js:21587:1)

Hi @yahyabagia

That’s strange.

Line 44 of that file just calls getCrypto().randomUUID():

And getCrypto is defined on line 5:

Also, according to Can I Use, Chrome for Android should support randomUUID():

What happens if you save the following to an HTML file and then open it in Chrome on the device?

<!DOCTYPE html>
<html>
  <head>
    <title>randomUUID test</title>
  </head>
  <body>
    <div id="uuid" />
    <script>
      var u = window.crypto.randomUUID();
      var uuid = document.getElementById("uuid");
      uuid.append(u);
    </script>
  </body>
</html>

Error was gone once I updated Nodejs to LTS.

2 Likes