Skip to content

Commit 5d0e54f

Browse files
author
Adam Rutland
committed
Fix for timeout issue causing build to get stuck and not fail
1 parent 1dffd12 commit 5d0e54f

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

lib/datapacktypes/omniscript.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ OmniScript.prototype.onDeployFinish = async function(jobInfo) {
184184
}
185185

186186
OmniScript.prototype.compileOSLWC = async function(jobInfo, omniScriptId,omniScriptKey) {
187+
188+
var browser;
189+
187190
try {
188191

189192
let puppeteerOptions = await utilityservice.prototype.getPuppeteerOptions(jobInfo);
@@ -201,7 +204,7 @@ OmniScript.prototype.compileOSLWC = async function(jobInfo, omniScriptId,omniScr
201204
var sessionToken = this.vlocity.jsForceConnection.accessToken;
202205
var loginURl = siteUrl + '/secur/frontdoor.jsp?sid=' + sessionToken;
203206
VlocityUtils.verbose('LWC Activation Login URL', loginURl);
204-
var browser;
207+
205208
try {
206209
browser = await puppeteer.launch(puppeteerOptions);
207210
} catch (error) {
@@ -287,8 +290,22 @@ OmniScript.prototype.compileOSLWC = async function(jobInfo, omniScriptId,omniScr
287290
}
288291
} catch (e) {
289292
VlocityUtils.error(e);
293+
294+
if (!jobInfo.omniScriptLwcActivationSkip) {
295+
jobInfo.omniScriptLwcActivationSkip = {};
296+
}
297+
jobInfo.omniScriptLwcActivationSkip[omniScriptKey] = errorMessage;
298+
jobInfo.hasError = true;
299+
jobInfo.currentStatus[omniScriptKey] = 'Error';
300+
jobInfo.currentErrors[omniScriptKey] = 'LWC Activation Error >> ' + omniScriptKey + ' - ' + e;
301+
jobInfo.errors.push('LWC Activation Error >> ' + omniScriptKey + ' - ' + e);
302+
VlocityUtils.error('LWC Activation Error', omniScriptKey + ' - ' + e);
303+
await this.deactivateOmniScript(omniScriptId);
304+
305+
try {
306+
browser.close();
307+
} catch (e2) {}
290308
}
291-
292309
}
293310

294311
OmniScript.prototype.onActivateError = async function(dataPackData) {

lib/datapacktypes/vlocitycard.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ VlocityCard.prototype.onDeployFinish = async function(jobInfo) {
3333
if (idsArray.length < 1){
3434
return;
3535
}
36+
37+
var browser;
3638

3739
try {
3840

@@ -44,11 +46,10 @@ VlocityCard.prototype.onDeployFinish = async function(jobInfo) {
4446
jobInfo.ignoreLWCActivationOS = true;
4547
} else {
4648
var package = this.vlocity.namespacePrefix;
47-
4849
var siteUrl = this.vlocity.jsForceConnection.instanceUrl;
4950
var sessionToken = this.vlocity.jsForceConnection.accessToken;
5051
var loginURl = siteUrl + '/secur/frontdoor.jsp?sid=' + sessionToken;
51-
var browser;
52+
5253
try {
5354
browser = await puppeteer.launch(puppeteerOptions);
5455
} catch (error) {
@@ -149,7 +150,6 @@ VlocityCard.prototype.onDeployFinish = async function(jobInfo) {
149150
var failedCardsId = failedCardsIds[i];
150151
var cardKey = jobInfo.flexCardsToCompile[failedCardsId];
151152
jobInfo.currentStatus[cardKey] = 'Error';
152-
//jobInfo.currentErrors[cardKey] = 'LWC Activation Error >> ' + cardKey + ' - ' + errorMessage;
153153
jobInfo.errors.push('LWC Activation Error >> ' + cardKey + ' - ' + errorMessage);
154154
VlocityUtils.error('LWC Activation Error', cardKey + ' - ' + errorMessage);
155155
}
@@ -159,6 +159,19 @@ VlocityCard.prototype.onDeployFinish = async function(jobInfo) {
159159
}
160160
} catch (e) {
161161
VlocityUtils.error(e);
162+
jobInfo.hasError = true;
163+
var failedCardsIds = Object.keys(jobInfo.flexCardsToCompile);
164+
for (let i = 0; i < failedCardsIds.length; i++) {
165+
var failedCardsId = failedCardsIds[i];
166+
var cardKey = jobInfo.flexCardsToCompile[failedCardsId];
167+
jobInfo.currentStatus[cardKey] = 'Error';
168+
jobInfo.errors.push('LWC Activation Error >> ' + cardKey + ' - ' + e);
169+
VlocityUtils.error('LWC Activation Error', cardKey + ' - ' + e);
170+
}
171+
172+
try {
173+
browser.close();
174+
} catch (e2) {}
162175
}
163176
}
164177

0 commit comments

Comments
 (0)