Why am I getting crypto.getRandomValues() not supported when trying to use "@aws-sdk/client-quicksight" in nodejs?

Viewed 32

I'm building an extension for a CMS (directus) and one of the dependencies @aws-sdk/client-quicksight is trying to use a module that is not supported (crypto). I get crypto.getRandomValues() not supported as an error from the CMS' logs;

How can I use @aws-sdk/client-quicksight in nodejs?

1 Answers

I found an answer from a similar problem that another library had: https://github.com/jsdom/jsdom/issues/1612

Basically add this so the dependency can find crypto:

import { Crypto } from "@peculiar/webcrypto"

global.crypto = new Crypto()
Related