@forge/cli
14.1.0-next.21-experimental-554d41714.1.0-next.19-experimental-fd0ebbc
out/deploy/deployer/deployer.js~
out/deploy/deployer/deployer.jsModified+16−9
Index: package/out/deploy/deployer/deployer.js
===================================================================
--- package/out/deploy/deployer/deployer.js
+++ package/out/deploy/deployer/deployer.js
@@ -56,8 +56,11 @@
}
function isDisplayEvent(event) {
return event.__typename === 'AppDeploymentDisplayEvent';
}
+function isLogEvent(event) {
+ return event.__typename === 'AppDeploymentLogEvent';
+}
const SUPPORTED_STYLES = new Set(['bold', 'dim', 'italic', 'underline', 'cyan', 'green', 'yellow', 'red', 'gray']);
const CONTROL_CHARS_RE = /\x1B(?:\[[0-9;]*[A-Za-z]|\][^\x07\x1B]*(?:\x07|\x1B\\)|[^[\]])?|[\x00-\x08\x0B\x0C\x0E-\x1A\x1C-\x1F\x7F]/g;
function stripControlSequences(input) {
return input.replace(CONTROL_CHARS_RE, '');
@@ -72,15 +75,18 @@
return `${bytes} ${bytes === 1 ? 'byte' : 'bytes'}`;
}
function getArtifactSizeMessage(errCode, fields) {
const text = cli_shared_1.Text.deploy.error.artifactTooLarge;
+ const record = typeof fields === 'object' && fields !== null && !Array.isArray(fields)
+ ? fields
+ : undefined;
const formatSize = (bytes) => typeof bytes === 'number' && Number.isFinite(bytes) && bytes > 0 ? formatArtifactBytes(bytes) : undefined;
- const { maxBytes, skillPath } = fields ?? {};
+ const { maxBytes, skillPath } = record ?? {};
const limit = formatSize(maxBytes);
const actual = formatSize({
- COMBINED_ARTIFACT_TOO_LARGE: fields?.sizeBytes,
- COMBINED_ARTIFACT_ENTRY_TOO_LARGE: fields?.uncompressedSize,
- COMBINED_ARTIFACT_TOTAL_UNCOMPRESSED_TOO_LARGE: fields?.totalUncompressedSize
+ COMBINED_ARTIFACT_TOO_LARGE: record?.sizeBytes,
+ COMBINED_ARTIFACT_ENTRY_TOO_LARGE: record?.uncompressedSize,
+ COMBINED_ARTIFACT_TOTAL_UNCOMPRESSED_TOO_LARGE: record?.totalUncompressedSize
}[errCode]);
const path = typeof skillPath === 'string'
? stripControlSequences(skillPath)
.replace(/[\r\n\t]+/g, ' ')
@@ -197,32 +203,33 @@
if (addNewLineBetweenTransitions) {
this.ui.emptyLine();
addNewLineBetweenTransitions = false;
}
- this.ui.info(cli_shared_1.Text.deploy.taskDeploy.serverStepStarted(event.stepName));
+ this.ui.info(cli_shared_1.Text.deploy.taskDeploy.serverStepStarted(event.stepName ?? ''));
}
}
else if (isDisplayEvent(event)) {
if (event.message) {
this.ui.info(parseDisplayMarkup(event.message));
}
}
- else if (event.message) {
+ else if (isLogEvent(event) && event.message) {
this.ui.debug(event.message);
}
};
}
handleErrorEvent(errorDetails, requestId) {
if (errorDetails) {
const { code, message } = errorDetails;
+ const fields = errorDetails.fields;
switch (code) {
case 'COMBINED_ARTIFACT_TOO_LARGE':
case 'COMBINED_ARTIFACT_ENTRY_TOO_LARGE':
case 'COMBINED_ARTIFACT_TOTAL_UNCOMPRESSED_TOO_LARGE': {
throw new AppDeploymentFailedError(true, requestId, getArtifactSizeMessage(code, errorDetails.fields));
}
case 'ENVIRONMENT_UPDATE_VALIDATION_FAILED': {
- const causeMessage = errorDetails?.fields?.validationResult.message.replace(/Upsert.*Error message: /, '');
+ const causeMessage = fields?.validationResult?.message.replace(/Upsert.*Error message: /, '');
if (causeMessage?.toLowerCase().includes('egress')) {
throw new AppDeploymentFailedError(true, requestId, cli_shared_1.Text.deploy.egressURL.error(causeMessage));
}
if (causeMessage?.toLowerCase().includes('existing installations')) {
@@ -232,9 +239,9 @@
else {
throw new ExistingInstallationsError(true, requestId, cli_shared_1.Text.deploy.crossContext.enableError);
}
}
- throw new AppDeploymentFailedError(true, requestId, cli_shared_1.Text.config.manifest.error(causeMessage));
+ throw new AppDeploymentFailedError(true, requestId, cli_shared_1.Text.config.manifest.error(causeMessage ?? message));
}
case 'HOSTED_RESOURCE_TOO_MANY_FILES':
case 'HOSTED_RESOURCE_ZIP_TOO_BIG':
case 'HOSTED_RESOURCE_FILE_PATH_REFERS_TO_PARENT':
@@ -265,9 +272,9 @@
case 'PRIVATE_APP_MISSING_DEVELOPER_SPACE': {
throw new AppDeploymentFailedError(true, requestId, cli_shared_1.Text.deploy.appBillingDetailsMissing.privateApp);
}
case 'MARKETPLACE_APP_MISSING_DEVELOPER_SPACE': {
- throw new AppDeploymentFailedError(true, requestId, cli_shared_1.Text.deploy.appBillingDetailsMissing.marketplaceApp(errorDetails.fields?.developerSpaceId));
+ throw new AppDeploymentFailedError(true, requestId, cli_shared_1.Text.deploy.appBillingDetailsMissing.marketplaceApp(fields?.developerSpaceId ?? ''));
}
case 'RATE_LIMITED': {
throw new AppDeploymentFailedError(false, requestId, message);
}