Fix Vercel URL (#661)
This commit is contained in:
@@ -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(
|
|||||||
// 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(
|
|||||||
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");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user