Skip to content

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

Fix: Serve frontend with binary

Daniel Hougaard85cfac512c96
diff --git a/backend/src/server/plugins/external-nextjs.ts b/backend/src/server/plugins/external-nextjs.ts
index cc2fe371d4..c5e4734ff2 100644
--- a/backend/src/server/plugins/external-nextjs.ts
+++ b/backend/src/server/plugins/external-nextjs.ts
@@ -18,20 +18,34 @@ export const registerExternalNextjs = async (
}
) => {
if (standaloneMode) {
- const nextJsBuildPath = path.join(dir, "frontend-build");
+ const frontendName = process?.pkg ? "frontend" : "frontend-build";
+
+ const nextJsBuildPath = path.join(dir, frontendName);
const { default: conf } = (await import(
- path.join(dir, "frontend-build/.next/required-server-files.json"),
+ path.join(dir, `${frontendName}/.next/required-server-files.json`),
// @ts-expect-error type
{
assert: { type: "json" }
}
)) as { default: { config: string } };
- /* eslint-disable */
- const { default: NextServer } = (
- await import(path.join(dir, "frontend-build/node_modules/next/dist/server/next-server.js"))
- ).default;
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ let NextServer: any;
+
+ if (!process?.pkg) {
+ /* eslint-disable */
+ const { default: nextServer } = (
+ await import(path.join(dir, `${frontendName}/node_modules/next/dist/server/next-server.js`))
+ ).default;
+
+ NextServer = nextServer;
+ } else {
+ /* eslint-disable */
+ const nextServer = await import(path.join(dir, `${frontendName}/node_modules/next/dist/server/next-server.js`));
+
+ NextServer = nextServer.default;
+ }
const nextApp = new NextServer({
dev: false,