Preview not running
No dev server found on port 3000.
-
- Ask the AI to start the dev server.
-
+
);
}
diff --git a/vibn-frontend/app/api/projects/[projectId]/dev-server/ensure/route.ts b/vibn-frontend/app/api/projects/[projectId]/dev-server/ensure/route.ts
index d2ad713..7ce681d 100644
--- a/vibn-frontend/app/api/projects/[projectId]/dev-server/ensure/route.ts
+++ b/vibn-frontend/app/api/projects/[projectId]/dev-server/ensure/route.ts
@@ -23,7 +23,7 @@ import {
} from "@/lib/dev-container";
export async function POST(
- _req: Request,
+ request: Request,
{ params }: { params: Promise<{ projectId: string }> },
) {
const { projectId } = await params;
@@ -96,7 +96,10 @@ export async function POST(
[projectId],
);
- if (!last) {
+ const forceStart =
+ new URL(request.url).searchParams.get("forceStart") === "true";
+
+ if (!last && !forceStart) {
return NextResponse.json({ status: "no_history" });
}
@@ -111,13 +114,12 @@ export async function POST(
}
// 4. Fire restart in background — don't block the response.
- // The probe (up to 300s) runs in background; anatomy polling at 5s
- // will surface state='starting' immediately, then 'running' when ready.
+ // If forceStart is true but we have no history, default to Next.js start command.
const restartOpts = {
projectId: project.id,
projectSlug: project.slug,
- command: last.command,
- port: last.port,
+ command: last?.command || "next dev -H 0.0.0.0 --no-turbopack",
+ port: last?.port || 3000,
workspace,
};