Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(frontend): guard window.__toCdnUrl against undefined to fix self-hosted blank screen

Fizza-Mukhtarc2b20129d79a
diff --git a/frontend/index.html b/frontend/index.html
index 7828141a32..a786ea9ddb 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -19,6 +19,7 @@
"
/>
<title>Infisical</title>
+ <script>window.__toCdnUrl = function(f) { return "/" + f; };</script>
<script src="/runtime-ui-env.js"></script>
</head>
<body>
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index 56fd3e1831..53d24a5d0d 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -55,9 +55,10 @@ export default defineConfig(({ mode }) => {
experimental: {
renderBuiltUrl(filename, { hostType }) {
if (hostType === "js") {
- return { runtime: `window.__toCdnUrl(${JSON.stringify(filename)})` };
+ const fallback = `function(f){ return "/" + f; }`;
+ const fn = `(typeof window.__toCdnUrl === "function" ? window.__toCdnUrl : ${fallback})`;
+ return { runtime: `${fn}(${JSON.stringify(filename)})` };
}
-
return { relative: true };
}
},