js icon indicating copy to clipboard operation
js copied to clipboard

bug: crypto is not defined

Open TheMikeyRoss opened this issue 6 months ago • 13 comments

Describe the bug

I followed the express.js tutorial and when I try to make a call to /logto/sign-in I get the following error

[1] const generateRandomString = (length = 64) => jsBase64.fromUint8Array(crypto.getRandomValues(new Uint8Array(length)), true);
[1]                                                                       ^
[1]
[1] ReferenceError: crypto is not defined

How to reproduce?

  1. Create a express backend
  2. Follow the express.js tutorial
  3. See the same error as above

Context

  • [ ] Logto Cloud
  • [x] Self-hosted, Logto version = 1.19.0
    • [x] Container (Docker image)
    • [ ] Raw Node.js

TheMikeyRoss avatar Aug 10 '24 07:08 TheMikeyRoss