Could not load the model because TypeError: crypto.randomUUID is not a function
nephaste opened this issue · 13 comments
What web browser are you using?
You'll need one that supports crypto.randomUUID as well as WebGPU
tried on opera 123.0.6312.124, Firefox 125.0.3 and chrome as well ...
the online demo works fine on all the browser ... i am a bit lost
@nephaste does https://secretllama.com work but running locally doesn't work?
yes exactly... i tested into an Ubuntu LXD container also on a Qnap NAS ... got same problem
That is really strange. I wonder if it has to do with running in non-secure context HTTP locally vs. HTTPS on the demo website.
I assume you've tried, but did you delete the entire code folder and retried it from scratch? Could be a yarn installation issue.
not tried in https, goal is to provide a QPKG for Qnap NAS
not sure how i can start secretllama over https with yarn build-and-preview ?
if you have information, without to have run a reverse proxy, i can try
i tried two way, with cross compiling (thinking it was a libc issue or a GCC issue on my dev environment) ,and without ... same result below the script use with cross compilation with my toolchain
my compile script is easy for cross compiling to be on same libc of the NAS Qnap and code can be executed
export PREFIX=/opt/SecretLLama
rm -rf /opt/SecretLLama
mkdir -p /opt/SecretLLama
cd /opt/SecretLLama
export some flags for cross compiling with toolchain
export npm_config_build_from_source=true
export CC=${HOST}-cc
export CXX=${HOST}-g++
#######################
echo "extract NodeJS" in PREFIX
#######################
tar -xvf /opt/NodeJS18/archive.tgz -C $PREFIX
####################
echo "Prepare env"
####################
mkdir -p /opt/SecretLLama/lib_elf
Copy stdc++ lib required to start nodejs
cp /DATA/x-tools/x86_64-QNAPGCC8-linux-gnu/x86_64-QNAPGCC8-linux-gnu/sysroot/lib/libstdc++.so.6.0.25 /opt/SecretLLama/lib_elf/libstdc++.so.6
use nodeJS from Prefix and added it to PATH for runtime build
export PATH=/opt/SecretLLama/bin:$PATH
#add yarn to prefix
/opt/SecretLLama/bin/npm install -g yarn --prefix /opt/SecretLLama/ ;
clone repo
git clone --recursive https://github.com/abi/secret-llama.git
cd secret-llama
use python 3.11 from Apache83 QPKG in case of need
export PATH=/opt/SecretLLama/bin:/opt/Apache83/bin:$PATH
export PYTHON=/opt/Apache83/bin/python3
start compiling
CC=${HOST}-gcc CXX=${HOST}-g++ npm_config_build_from_source=true /opt/SecretLLama/bin/yarn ;
start secretllama
export LD_LIBRARY_PATH=/opt/SecretLLama/lib_elf:$LD_LIBRARY_PATH
CC=${HOST}-gcc CXX=${HOST}-g++ npm_config_build_from_source=true /opt/SecretLLama/bin/yarn build-and-preview ;
I run into the same Issue on Archlinux with a native x86 processor.
What URL are you guys using to access the app? Something like http://172.22.0.4
, if you're running it in a container?
crypto.randomUUID will only run in secure contexts, which means that the webpage must either:
- be served over
https://
, or - be considered locally-delivered, e.g.
http://127.0.0.1
,http://localhost
,http://some.local.subdomain.localhost
, etc
If you're planning to set this up for other people to access, a reverse proxy would probably be the best way to go.
But if it's just for development you could try something like mkcert or ssl-proxy.
then no way to start it in https and to provide a cert and key certificate (even a self signed one) ?
will be nice to modify code, to start yarn in https instead of http by default, which seems create this behavior
If you have a self signed cert, you can add it to the vite config like this:
diff --git a/vite.config.ts b/vite.config.ts
index bf12e0d..9839a09 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -2,10 +2,17 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import checker from "vite-plugin-checker";
import path from "path";
+import fs from "fs";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), checker({ typescript: true })],
+ server: {
+ https: {
+ key: fs.readFileSync("key.pem"),
+ cert: fs.readFileSync("cert.pem"),
+ },
+ },
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
Vite will then serve the app over https when you run yarn build-and-preview
!
Edit:
If you don't already have a cert, you could try this vite plugin which will generate one for you.
thanks will give a try ... do you plane to modfify the code itself ?
that we can add our own certs to Secretllama ?
Generally, i check and export CERT and KEY location to add it on startup command line
Check if MyQnapCloud Lets Encrypt/SSL certificate exists
if [ -f /mnt/ext/opt/QcloudSSLCertificate/cert/cert ]
then
echo "Found MyQnapCloud Lets Encrypt/SSL certificate and use it"
export CERT=/mnt/ext/opt/QcloudSSLCertificate/cert/cert
export KEY=/mnt/ext/opt/QcloudSSLCertificate/cert/key
else
echo "MyQnapCloud Lets Encrypt/SSL certificate not found, i am using self-signed certificate from QTS"
export CERT=/etc/stunnel/backup.cert
export KEY=/etc/stunnel/backup.key
fi
I managed to get it to work with an SSL proxy.