Skip to content

Commit

Permalink
Fix for timeout issue causing build to get stuck and not fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Rutland committed Nov 9, 2021
1 parent 1dffd12 commit 5d0e54f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
21 changes: 19 additions & 2 deletions lib/datapacktypes/omniscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ OmniScript.prototype.onDeployFinish = async function(jobInfo) {
}

OmniScript.prototype.compileOSLWC = async function(jobInfo, omniScriptId,omniScriptKey) {

var browser;

try {

let puppeteerOptions = await utilityservice.prototype.getPuppeteerOptions(jobInfo);
Expand All @@ -201,7 +204,7 @@ OmniScript.prototype.compileOSLWC = async function(jobInfo, omniScriptId,omniScr
var sessionToken = this.vlocity.jsForceConnection.accessToken;
var loginURl = siteUrl + '/secur/frontdoor.jsp?sid=' + sessionToken;
VlocityUtils.verbose('LWC Activation Login URL', loginURl);
var browser;

try {
browser = await puppeteer.launch(puppeteerOptions);
} catch (error) {
Expand Down Expand Up @@ -287,8 +290,22 @@ OmniScript.prototype.compileOSLWC = async function(jobInfo, omniScriptId,omniScr
}
} catch (e) {
VlocityUtils.error(e);

if (!jobInfo.omniScriptLwcActivationSkip) {
jobInfo.omniScriptLwcActivationSkip = {};
}
jobInfo.omniScriptLwcActivationSkip[omniScriptKey] = errorMessage;
jobInfo.hasError = true;
jobInfo.currentStatus[omniScriptKey] = 'Error';
jobInfo.currentErrors[omniScriptKey] = 'LWC Activation Error >> ' + omniScriptKey + ' - ' + e;
jobInfo.errors.push('LWC Activation Error >> ' + omniScriptKey + ' - ' + e);
VlocityUtils.error('LWC Activation Error', omniScriptKey + ' - ' + e);
await this.deactivateOmniScript(omniScriptId);

try {
browser.close();
} catch (e2) {}
}

}

OmniScript.prototype.onActivateError = async function(dataPackData) {
Expand Down
19 changes: 16 additions & 3 deletions lib/datapacktypes/vlocitycard.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ VlocityCard.prototype.onDeployFinish = async function(jobInfo) {
if (idsArray.length < 1){
return;
}

var browser;

try {

Expand All @@ -44,11 +46,10 @@ VlocityCard.prototype.onDeployFinish = async function(jobInfo) {
jobInfo.ignoreLWCActivationOS = true;
} else {
var package = this.vlocity.namespacePrefix;

var siteUrl = this.vlocity.jsForceConnection.instanceUrl;
var sessionToken = this.vlocity.jsForceConnection.accessToken;
var loginURl = siteUrl + '/secur/frontdoor.jsp?sid=' + sessionToken;
var browser;

try {
browser = await puppeteer.launch(puppeteerOptions);
} catch (error) {
Expand Down Expand Up @@ -149,7 +150,6 @@ VlocityCard.prototype.onDeployFinish = async function(jobInfo) {
var failedCardsId = failedCardsIds[i];
var cardKey = jobInfo.flexCardsToCompile[failedCardsId];
jobInfo.currentStatus[cardKey] = 'Error';
//jobInfo.currentErrors[cardKey] = 'LWC Activation Error >> ' + cardKey + ' - ' + errorMessage;
jobInfo.errors.push('LWC Activation Error >> ' + cardKey + ' - ' + errorMessage);
VlocityUtils.error('LWC Activation Error', cardKey + ' - ' + errorMessage);
}
Expand All @@ -159,6 +159,19 @@ VlocityCard.prototype.onDeployFinish = async function(jobInfo) {
}
} catch (e) {
VlocityUtils.error(e);
jobInfo.hasError = true;
var failedCardsIds = Object.keys(jobInfo.flexCardsToCompile);
for (let i = 0; i < failedCardsIds.length; i++) {
var failedCardsId = failedCardsIds[i];
var cardKey = jobInfo.flexCardsToCompile[failedCardsId];
jobInfo.currentStatus[cardKey] = 'Error';
jobInfo.errors.push('LWC Activation Error >> ' + cardKey + ' - ' + e);
VlocityUtils.error('LWC Activation Error', cardKey + ' - ' + e);
}

try {
browser.close();
} catch (e2) {}
}
}

Expand Down

0 comments on commit 5d0e54f

Please sign in to comment.