Why am I getting an "Uncaught DOM Exception" in the Deno CLI?

To replicate:
1. deno in the command line to initialize a Deno REPL
// Get an array of random bytes
const arr = new Uint8Array(32)
crypto.getRandomValues(arr)

const decoder = new TextDecoder("utf8")
btoa(decoder.decode(arr));
> Uncaught DOMException


The goal was to get a base64 encoding of the byte array. What am I doing wrong? atob produces the same result.
Was this page helpful?