Unverified 提交 db191ae7 authored 作者: Will Chen's avatar Will Chen 提交者: GitHub

Fix Vercel URL (#661)

上级 78c93375
...@@ -286,7 +286,6 @@ async function handleCreateProject( ...@@ -286,7 +286,6 @@ async function handleCreateProject(
framework: detectedFramework, framework: detectedFramework,
}, },
}); });
if (!projectData.id) { if (!projectData.id) {
throw new Error("Failed to create project: No project ID returned."); throw new Error("Failed to create project: No project ID returned.");
} }
...@@ -294,13 +293,18 @@ async function handleCreateProject( ...@@ -294,13 +293,18 @@ async function handleCreateProject(
// Get the default team ID // Get the default team ID
const teamId = await getDefaultTeamId(accessToken); const teamId = await getDefaultTeamId(accessToken);
const projectDomains = await vercel.projects.getProjectDomains({
idOrName: projectData.id,
});
const projectUrl = "https://" + projectDomains.domains[0].name;
// Store project info in the app's DB row // Store project info in the app's DB row
await updateAppVercelProject({ await updateAppVercelProject({
appId, appId,
projectId: projectData.id, projectId: projectData.id,
projectName: projectData.name, projectName: projectData.name,
teamId: teamId, teamId: teamId,
deploymentUrl: null, // Will be set after first deployment deploymentUrl: projectUrl,
}); });
logger.info( logger.info(
...@@ -322,21 +326,11 @@ async function handleCreateProject( ...@@ -322,21 +326,11 @@ async function handleCreateProject(
repo: app.githubRepo, repo: app.githubRepo,
ref: app.githubBranch || "main", ref: app.githubBranch || "main",
}, },
// projectSettings: {
// framework: "vite",
// },
}, },
}); });
if (deploymentData.url) { if (deploymentData.url) {
// Update deployment URL in the database logger.info(`First deployment successful: ${deploymentData.url}`);
const deploymentUrl = `https://${deploymentData.url}`;
await db
.update(apps)
.set({ vercelDeploymentUrl: deploymentUrl })
.where(eq(apps.id, appId));
logger.info(`First deployment successful: ${deploymentUrl}`);
} else { } else {
logger.warn("First deployment failed: No deployment URL returned"); logger.warn("First deployment failed: No deployment URL returned");
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论