[next] Support pre-generated pages without fallbacks with Partial Prerendering (#11183)

This commit is contained in:
Wyatt Johnson
2024-03-01 18:29:31 -07:00
committed by GitHub
parent 24ec5c5aca
commit b1d8b83abb
8 changed files with 327 additions and 108 deletions

View File

@@ -119,16 +119,28 @@ async function disableSSO(deploymentId, useTeam = true) {
}
);
const text = await deployRes.text();
if (!deployRes.ok) {
throw new Error(
`Failed to get deployment info (status: ${
deployRes.status
}, body: ${await deployRes.text()})`
`Failed to get deployment info (status: ${deployRes.status}, body: ${text})`
);
}
const deploymentInfo = await deployRes.json();
const { projectId, url: deploymentUrl } = deploymentInfo;
let info;
try {
info = JSON.parse(text);
} catch (err) {
throw new Error('Failed to parse deployment info JSON', { cause: err });
}
const { projectId, url: deploymentUrl } = info;
if (!deploymentUrl || typeof deploymentUrl !== 'string') {
throw new Error(
`Failed to get deployment URL (status: ${deployRes.status}, body: ${text})`
);
}
const settingRes = await fetchWithAuth(
`https://vercel.com/api/v5/projects/${encodeURIComponent(projectId)}`,
@@ -160,7 +172,7 @@ async function disableSSO(deploymentId, useTeam = true) {
`Disabled deployment protection for deploymentId: ${deploymentId} projectId: ${projectId}`
);
} else {
console.error(settingRes.status, await settingRes.text(), deploymentInfo);
console.error(settingRes.status, await settingRes.text(), text);
throw new Error(
`Failed to disable deployment protection projectId: ${projectId} deploymentId ${deploymentId}`
);