mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-08 04:22:09 +00:00
[now-static-build] Update error message to mention project settings (#3926)
This PR improves the error message to make it actionable. The docs will be updated in https://github.com/zeit/docs/pull/1661 with even more detail.
This commit is contained in:
@@ -60,7 +60,7 @@ function validateDistDir(distDir: string) {
|
|||||||
if (!exists()) {
|
if (!exists()) {
|
||||||
throw new NowBuildError({
|
throw new NowBuildError({
|
||||||
code: 'NOW_STATIC_BUILD_NO_OUT_DIR',
|
code: 'NOW_STATIC_BUILD_NO_OUT_DIR',
|
||||||
message: `No Output Directory named "${distDirName}" found after the Build completed.`,
|
message: `No Output Directory named "${distDirName}" found after the Build completed. You can configure the Output Directory in your project settings.`,
|
||||||
link,
|
link,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,39 +89,54 @@ async function filePost (body, digest) {
|
|||||||
'x-now-size': body.length,
|
'x-now-size': body.length,
|
||||||
};
|
};
|
||||||
|
|
||||||
const resp = await fetchWithAuth('/v2/now/files', {
|
const url = '/v2/now/files';
|
||||||
|
|
||||||
|
const resp = await fetchWithAuth(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers,
|
headers,
|
||||||
body,
|
body,
|
||||||
});
|
});
|
||||||
|
|
||||||
const json = await resp.json();
|
const json = await resp.json();
|
||||||
|
|
||||||
if (json.error) {
|
if (json.error) {
|
||||||
console.log('headers', resp.headers);
|
const { status, statusText, headers } = resp;
|
||||||
throw new Error(json.error.message);
|
const { message } = json.error;
|
||||||
|
console.log('Fetch Error', { url , status, statusText, headers, digest });
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deploymentPost (payload) {
|
async function deploymentPost (payload) {
|
||||||
const resp = await fetchWithAuth('/v6/now/deployments?forceNew=1', {
|
const url = '/v6/now/deployments?forceNew=1';
|
||||||
|
const resp = await fetchWithAuth(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(payload),
|
body: JSON.stringify(payload),
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`fetch status: ${resp.status} ${resp.statusText}`);
|
|
||||||
const json = await resp.json();
|
const json = await resp.json();
|
||||||
|
|
||||||
if (json.error) {
|
if (json.error) {
|
||||||
console.log('headers', resp.headers);
|
const { status, statusText, headers } = resp;
|
||||||
throw new Error(json.error.message);
|
const { message } = json.error;
|
||||||
|
console.log('Fetch Error', { url , status, statusText, headers });
|
||||||
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deploymentGet (deploymentId) {
|
async function deploymentGet (deploymentId) {
|
||||||
const resp = await fetchWithAuth(`/v3/now/deployments/${deploymentId}`);
|
const url = `/v3/now/deployments/${deploymentId}`;
|
||||||
return await resp.json();
|
const resp = await fetchWithAuth(url);
|
||||||
|
const json = await resp.json();
|
||||||
|
if (json.error) {
|
||||||
|
const { status, statusText, headers } = resp;
|
||||||
|
const { message } = json.error;
|
||||||
|
console.log('Fetch Error', { url , status, statusText, headers });
|
||||||
|
throw new Error(message);
|
||||||
|
}
|
||||||
|
return json
|
||||||
}
|
}
|
||||||
|
|
||||||
let token;
|
let token;
|
||||||
|
|||||||
Reference in New Issue
Block a user