ucbepic / docetl

A system for agentic LLM-powered data processing and ETL
https://docetl.org
MIT License
1.26k stars 114 forks source link

Web part uses crypto.randomUUID from Web Crypto API which is available only in secure context (HTTPS), or localhost #153

Closed plpycoin closed 1 week ago

plpycoin commented 1 week ago

Description

When uploading a YAML file from a non-localhost or non-HTTPS environment, the following problem is encountered:

image

Likely causes

https://stackoverflow.com/questions/74911304/crypto-module-not-loading-randomuuid-when-viewing-a-local-network-ip-address

staru09 commented 1 week ago

Can you elaborate more about your use case and this issue too?

redhog commented 1 week ago

This is a problem mostly during testing, when running things from localhost and you don't need https. Add the following somewhere early in the code as a polyfill to fix:

try {
  crypto.randomUUID();
} catch (e) {
  crypto.randomUUID = () => {
    var chars = crypto.getRandomValues(new Uint8Array(31));
    return "10000000-1000-4000-8000-100000000000".replace(
      /[018]/g,
      (c, i) => ((c ^ chars[i]) & (15 >> (c / 4))).toString(16)
    );
  };
}
shreyashankar commented 1 week ago

interesting that makes sense for the crypto API. these are just used for operation ids; I think it's fine to use another library like uuid. will make a PR to fix