This repo is a plugin, but we keep VPS ops notes here because these issues are easy to forget and painful to rediscover.
- File attach / drag-and-drop fails with:
TypeError: crypto.randomUUID is not a function
- Copy/share fails with:
TypeError: undefined is not an object (evaluating 'navigator.clipboard.writeText')
- Sessions sometimes "load forever" after a bad deployment/change:
SyntaxError: Unexpected token '}' ...(often a cached/broken chunk)
- On
http://Safari often lackscrypto.randomUUID()(or providescryptowithoutrandomUUID) depending on OS/browser version and secure context. - On
http://Safari often does not exposenavigator.clipboardat all. - If you override a hashed chunk (e.g.
session-*.js) and produce a broken file, the browser can cache it and keep failing until cache is bypassed.
-
Do not rewrite/override
session-*.jschunks.- Instead, proxy them from the upstream OpenCode server and force
Cache-Control: no-storeto avoid sticky caching of a bad module.
- Instead, proxy them from the upstream OpenCode server and force
-
Patch only the main bundle
assets/index-<hash>.js(the entry module) to add:- a
crypto.randomUUIDpolyfill fallback - a clipboard fallback that works on
http://(textarea +document.execCommand('copy'))
- a
-
If you run upstream behind nginx basic-auth, inject the upstream
Authorizationheader at nginx so the browser doesn't need to send it to127.0.0.1upstream.
Files in this folder:
ops/opencode-vps/nginx-opencode.conf.example: nginx server block templateops/opencode-vps/scripts/patch-opencode-web.sh: helper to patch the main bundle
- If the server "randomly died" during heavy tasks, check systemd logs for OOM:
journalctl -u opencode --no-pager | rg -n \"OOM killer|oom-kill\"
- If a session is "stuck loading", a quick mitigation is opening in a private tab.
A proper mitigation is
no-storeon the session chunk route as described above.