Skip to content

node: executing crypto.randomBytes says crypto.getRandomValues ​​is not a function #2114

@naijun0403

Description

@naijun0403

Describe the bug
When I run crypto.randomBytes, it says crypto.getRandomValues ​​is not a function
Steps to Reproduce

  1. enter to deno repl
  2. > crypto.randomBytes(10)
  3. Uncaught TypeError: crypto.getRandomValues is not a function
    at generateRandomBytes (https://deno.land/std@0.134.0/node/_crypto/randomBytes.ts:24:12)
    at Object.randomBytes (https://deno.land/std@0.134.0/node/_crypto/randomBytes.ts:68:12)
    at :2:8

Expected behavior

> crypto.randomBytes(10)
<Buffer (hex)>

Environment

  • OS: MacOS 11
  • deno version: 1.20.5
  • std version: 0.134.0

I looked at the release notes for std 0.135.0, there was no such issue fix.

It is likely that the issue will be reproduced in 0.135.0 as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions