Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: crypto.randomUUID is not a function #32

Open
jbjornson opened this issue Nov 24, 2023 · 3 comments
Open

Uncaught TypeError: crypto.randomUUID is not a function #32

jbjornson opened this issue Nov 24, 2023 · 3 comments

Comments

@jbjornson
Copy link

I get the following error in the console when running refacto locally. The retro page loads, but as soon as I try to submit a comment or action, it generates this console error (no reaction in the browser).

259.65606303.js:2 Uncaught TypeError: crypto.randomUUID is not a function
    at i (index.5303f92b.js:1:441)
    at 74.0b2d8329.js:1:16895
    at index.5303f92b.js:1:12254
    at 74.0b2d8329.js:1:9136
    at 74.0b2d8329.js:1:5903
    at Object.De (259.65606303.js:2:27447)
    at He (259.65606303.js:2:27601)
    at 259.65606303.js:2:47462
    at Ir (259.65606303.js:2:47556)
    at jr (259.65606303.js:2:47970)
@davidje13
Copy link
Owner

davidje13 commented Nov 27, 2023

That API should be available in all recent browsers (anything updated since March 2022); which browser are you using? Do you have any special plugins or flags active?

Also are you connecting via localhost or are you trying to connect from another computer on the network? (browsers may disable parts of the crypto API if they don't think it's over a secure connection - http to localhost counts as secure, but http to a local IP address might not)

@jbjornson
Copy link
Author

jbjornson commented Jun 13, 2024

Also connecting via localhost on macos. I tried with latest versions of Chrome, Brave and Safari and all failed. I hacked the code to use uuid rather than node:crypto and it works without issues.

-import { randomUUID } from 'node:crypto';
+import { v4 as uuidv4 } from 'uuid';

with changes to the code like:

-    const id = randomUUID();
+    const id = uuidv4();

@davidje13
Copy link
Owner

davidje13 commented Jun 14, 2024

ah I misunderstood before; I thought you were seeing the error in the browser but I see you mean on the backend.

What version of NodeJS are you using? (node --version) Refacto is tested on 18, 20, 21, and 22. Older versions of NodeJS are unsupported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants