Console error randomUUID is not a function

Hello all When I try to create a new record with ember data, i face the following issue:

-private.js:129 Uncaught TypeError: _crypto.randomUUID is not a function
    at uuidv4 (-private.js:129:1)
    at IdentifierCache.defaultGenerationMethod [as _generate] (-private.js:167:1)
    at IdentifierCache.createIdentifierForNewRecord (-private.js:362:1)
    at -private.js:5440:1
    at Store._run (-private.js:5162:1)
    at Store._join (-private.js:5178:1)
    at -private.js:5410:1
    at Backburner._run (backburner.js:1052:1)
    at Backburner._join (backburner.js:1028:1)
    at Backburner.join (backburner.js:779:1)

It looks, like the store uses this function to create an uuid for the records. But why is this library missing? It must be included in the recent versions of node (what I understood)

I’m running ember in docker with the version 4.12.1 from Docker

My system is an Apple Silicon, if that would make a difference.

Thank you for your time to read this :slight_smile:

Hi @herrnesto, welcome!

IIRC crypto.randomUUID is only available in HTTPS context, and some browsers and also older node versions don’t support it. I’d suggest using the optional polyfill. To enable it try following the instructions here.

Possibly also worth trying to figure out why you’re hitting it. Are you running in http instead of https? Do you have an older version of Node (<=12)? Or Safari?

1 Like

Hey Dan

Now it works. Thank you very much!

And sorry for the late feedback. I put the project on hold for a while.

Have a wonderful day :sun_with_face:

1 Like