Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlexCard Compilation Error #475

Closed
lotusboy opened this issue Jun 13, 2022 · 65 comments · Fixed by #577
Closed

FlexCard Compilation Error #475

lotusboy opened this issue Jun 13, 2022 · 65 comments · Fixed by #577

Comments

@lotusboy
Copy link

Hi,

As part of our vlocity deployment, we have 3 FlexCards which are failing to compile and so cannot subsequently be deployed. Omniscripts are compiling successfully.

Interestingly, if I set lwcCompilerVersion: "890.331", meaning the legacy method is used, the FlexCards get compiled and deployed successfully.

Vlocity Build v1.15.3
Vlocity version 890.331

Log showing the first FlexCard error:
...
Loading @vlocity-ins/flexcard-compiler@890.331
Compiling Flexcard with FlexCard ID: >> a6J0E000002GcOkUAK
/usr/local/lib/node_modules/vlocity/node_modules/runtime-plugin-manager-clone/dist/src/PluginVm.js:74
throw new Error("Invalid javascript file " + filePath);
^

Error: Invalid javascript file /Users/sloftus/Documents/git/smartchassis/vlocity-temp/plugins/copy-anything/dist/index.cjs
at PluginVm.load (/usr/local/lib/node_modules/vlocity/node_modules/runtime-plugin-manager-clone/dist/src/PluginVm.js:74:19)
at PluginManager.load (/usr/local/lib/node_modules/vlocity/node_modules/runtime-plugin-manager-clone/dist/src/PluginManager.js:553:24)
at PluginManager.require (/usr/local/lib/node_modules/vlocity/node_modules/runtime-plugin-manager-clone/dist/src/PluginManager.js:191:21)
at PluginVm.sandboxRequire (/usr/local/lib/node_modules/vlocity/node_modules/runtime-plugin-manager-clone/dist/src/PluginVm.js:252:33)
at Object.assign.resolve (/usr/local/lib/node_modules/vlocity/node_modules/runtime-plugin-manager-clone/dist/src/PluginVm.js:178:25)
at /Users/sloftus/Documents/git/smartchassis/vlocity-temp/plugins/less/lib/less/utils.js:8:23
at /Users/sloftus/Documents/git/smartchassis/vlocity-temp/plugins/less/lib/less/utils.js:127:2
at Script.runInContext (node:vm:139:12)
at PluginVm.vmRunScriptInSandbox (/usr/local/lib/node_modules/vlocity/node_modules/runtime-plugin-manager-clone/dist/src/PluginVm.js:136:16)
at PluginVm.load (/usr/local/lib/node_modules/vlocity/node_modules/runtime-plugin-manager-clone/dist/src/PluginVm.js:61:22)
...

@depill
Copy link

depill commented Jun 18, 2022

@lotusboy runtime-plugin-manager-clone looks only for the imports ending with js. copy-anything did ( in my mind an API breaking ) change in 2.0.6 that no longer points to the .js but the cjs. Less depends on it with ^.

You can manually fix it by copying copy-anything@2.0.1 into the vlocity-temp/plugins folder while waiting for a fix on this.

@AllanOricil
Copy link
Contributor

relates: #486

@AllanOricil
Copy link
Contributor

AllanOricil commented Jul 12, 2022

@deanjesper
Copy link
Contributor

@lotusboy runtime-plugin-manager-clone looks only for the imports ending with js. copy-anything did ( in my mind an API breaking ) change in 2.0.6 that no longer points to the .js but the cjs. Less depends on it with ^.

You can manually fix it by copying copy-anything@2.0.1 into the vlocity-temp/plugins folder while waiting for a fix on this.

When we use copy-anything@2.0.1, we get this error:

abort(ReferenceError: sessionStorage is not defined). Build with -s ASSERTIONS=1 for more info.

Anyone else getting this?

@deanjesper
Copy link
Contributor

Just to add to my above comment, there is an issue in the file: /vlocity-temp/plugins/@omnistudio/flexcard-compiler/src/compiler/flexCardUtility/fetchCustomLabels.js

Lines 8-23 and line 104 mention sessionStorage. If you comment some of those lines out, the compiler will work, although from what I've experienced, the compiler doesn't work well if you're using a Vlocity managed package (vlocity-cmt, vlocity-ins etc)

@AllanOricil
Copy link
Contributor

AllanOricil commented Jul 27, 2022

@centricadean use copy-anything@2.0.6. Im using it and I don't get the problem you experienced.
image

and flexcard-compiler@900.458.0
image

@deanjesper
Copy link
Contributor

deanjesper commented Jul 27, 2022

@centricadean use copy-anything@2.0.6. Im using it and I don't get the problem you experienced.
image

Is the compiler working on vlocity-cme for you with copy-anything@2.0.6? @AllanOricil

@AllanOricil
Copy link
Contributor

@centricadean use copy-anything@2.0.6. Im using it and I don't get the problem you experienced.
image

Is the compiler working on vlocity-cme for you with copy-anything@2.0.6? @AllanOricil

Yes, but I had to add this version of copy-anything inside ./vlocity-temp/plugins/

The flexcard-compiler had a different error and I had to fix it after it was downloaded. Then I also versioned it inside ./vlocity-temp/plugins so that vlocity-cli doesn't download it again. The issue is that the compiler as is was generating components with namespace c instead of vlocity_cmt.

@AllanOricil
Copy link
Contributor

AllanOricil commented Jul 27, 2022

@centricadean I'm also using vlocity-cli@1.15.6

@deanjesper
Copy link
Contributor

OK will give 2.0.6 a go!

I'm also having an issue with the compiler using namespace c instead of vlocity_cmt. I tried making some changes in the temp folder for the compiler but some components like c:spinner aren't getting compiled as vlocity_cmt-spinner...

#492

@deanjesper
Copy link
Contributor

@AllanOricil I'm running copy-anything@2.0.6 and I'm getting this error:

/usr/local/lib/node_modules/vlocity/node_modules/runtime-plugin-manager-clone/dist/src/PluginVm.js:74
            throw new Error("Invalid javascript file " + filePath);

When I downgrade to copy-anything@2.0.1 I get an error to do with sessionStorage in this file:

/vlocity-temp/plugins/@vlocity-cme/flexcard-compiler/src/compiler/flexCardUtility/fetchCustomLabels.js

Using vlocity@1.15.6 too

@AllanOricil
Copy link
Contributor

AllanOricil commented Jul 27, 2022

@AllanOricil I'm running copy-anything@2.0.6 and I'm getting this error:

/usr/local/lib/node_modules/vlocity/node_modules/runtime-plugin-manager-clone/dist/src/PluginVm.js:74
            throw new Error("Invalid javascript file " + filePath);

When I downgrade to copy-anything@2.0.1 I get an error to do with sessionStorage in this file:

/vlocity-temp/plugins/@vlocity-cme/flexcard-compiler/src/compiler/flexCardUtility/fetchCustomLabels.js

Using vlocity@1.15.6 too

@centricadean
Inside copy-anything you must ""append"" .js to their file names

You have to end up having these files:

index.cjs.js
index.es.js

@deanjesper
Copy link
Contributor

deanjesper commented Jul 27, 2022

Thanks @AllanOricil - that works, but then I get the sessionStorage error again. I'm hitting this error when trying to deploy the LWC cart FlexCards which I think use custom labels.

Screenshot 2022-07-27 at 1 40 02 pm

@AllanOricil
Copy link
Contributor

AllanOricil commented Jul 27, 2022

This is possibly a new bug. Could you open an issue describing minimal steps to reproduce this error you are experiencing. This will help people to fix it. I can look at it later.
Could you also create a custom vlocity component that uses custom labels and see if the same issue happens? Maybe it is not something related to the cart component only.

@deanjesper
Copy link
Contributor

Raised a new issue, will try a custom Vlocity component with custom labels shortly

@KevinGossentCap
Copy link
Contributor

Just tried with latest VBT and latest SFI version (CMT 240.8)
Took only 1 omniscript & 1 vlocitycard
OmniScript/CPQ_cartConfigurator_Multi-Language
VlocityCard/cpqProductTileList

OS compiles OK
Card gives a strange error
Compiling Flexcard with FlexCard ID: >> a5a6S000007JdoAQAS
APEX_ERROR: System.LimitException: JSON string exceeds heap size limit

(System Code)
at HttpApi.getError (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\jsforce\lib\http-api.js:250:13)
at C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\jsforce\lib\http-api.js:95:22
at tryCallOne (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\promise\lib\core.js:37:12)
at C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\promise\lib\core.js:123:15
at flush (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\asap\raw.js:50:29)
at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
errorCode: 'APEX_ERROR'
}
The error is NOT BLOCKING O_O
how can we know if it's ok ?

LWC created and deployed but definitely not safe given the error

@AllanOricil
Copy link
Contributor

@KevinGossentCap vlocity build tool does not work like the Metadata API does. There is no such thing as Deploy All or None. You have to deploy everything that has changed over and over again until all errors are fixed. Beside that, in your CI pipeline, you need to read the vlocity job output file to check if there were errors or not, and exit 1 if there were errors. It is a json file which contains everything that was processed by the cli.

@KevinGossentCap
Copy link
Contributor

Hi @AllanOricil You should look and read back the subject of this ticket.
It's all about localCompile, the feature proposed since 1 year ago and that is still struggling to work on vlocity component themselves.
To make it clearer, here is more of my log where we see clearly that it is the VBT process locally compiling the vlocityCard which is giving the ERROR. And what I ask is "how can we have trust/faith in what's deployed if the job creating what's deployed return such an error

Loading @vlocity-cme/omniscript-lwc-compiler@latest
Starting OmniScript LWC Compilation >> OmniScript/CPQ_cartConfigurator_Multi-Language (a336S000003FaBbQAK)
Retrieving OmniScript definition
Compiling OmniScript LWC Component
Specified path does not exist. Creating it now...
LWC for FlexCard will be compiled at the end >> VlocityCard/cpqProductTileList
Salesforce Org >> sfi_esm_win23
Version Info >> v1.16.1 vlocity_cmt 900.468
Current Status >> Deploy
Remaining >> 0
Success >> 2
Error >> 0
Elapsed Time >> 1m 4s
Migrated 2 items >> Deploying
Loading @vlocity-cme/flexcard-compiler@latest
Compiling Flexcard with FlexCard ID: >> a5a6S000007JdoAQAS
APEX_ERROR: System.LimitException: JSON string exceeds heap size limit

(System Code)
at HttpApi.getError (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\jsforce\lib\http-api.js:250:13)
at C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\jsforce\lib\http-api.js:95:22
at tryCallOne (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\promise\lib\core.js:37:12)
at C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\promise\lib\core.js:123:15
at flush (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\asap\raw.js:50:29)
at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
errorCode: 'APEX_ERROR'
}
Specified path does not exist. Creating it now...
Deploying generated LWC components
Using salesforce-alm
Running source:convert
Source was successfully converted to Metadata API format and written to the location: C:\GitRepos\HubOne\defaultEmpty_CPQ_LWC_240\vlocity-temp\mdapi
source:convert ended successfully
Running mdapi:deploy
Job ID | 0Af6S00000pzrnxSAA
MDAPI PROGRESS | ████████████████████████████████████████ | 2/2 Components
mdapi:deploy ended successfully
Metadata Deployed >> LightningComponentBundle/cPQCartConfiguratorMultiLanguage
Metadata Deployed >> LightningComponentBundle/cfCpqProductTileList
Finalizing Deployment
Salesforce Org >> sfi_esm_win23
Version Info >> v1.16.1 vlocity_cmt 900.468
Current Status >> Deploy
Remaining >> 0
Success >> 4
Error >> 0
Elapsed Time >> 3m 1s
Migrated 4 items >> Deploying
Job Complete >> Deploy 3m 1s
Deploy success:
4 Completed

@AllanOricil
Copy link
Contributor

@KevinGossentCap would you be able to zip this flexicard datapack and paste it here. I need to use it to debug the compiler. The error message does not help much to determine the root cause of the problem.

@AllanOricil
Copy link
Contributor

AllanOricil commented Nov 29, 2022

@KevinGossentCap could you also run vlocity cli again but with --verbose

image

I'm almost certain it won't show the errors I need because the compiler has its verbose prop hardcoded to false, but let's give it a try.

image

My guess is that one of these custom rest services is causing that system limit exception

image

Could you also open your debug logs and try to identify which apex method throws this exception while the compiler is running APEX_ERROR: System.LimitException: JSON string exceeds heap size limit

@KevinGossentCap
Copy link
Contributor

@KevinGossentCap would you be able to zip this flexicard datapack and paste it here. I need to use it to debug the compiler. The error message does not help much to determine the root cause of the problem.

Hi @AllanOricil they are both from "industry CPQ LWC" static ressources. So both provided directly by vlocity/Salesforce.
I find it hard to believe they "fixed" the "sessionStorage" error without testing that there was no other error hidden by the first one...

@KevinGossentCap
Copy link
Contributor

KevinGossentCap commented Nov 30, 2022

@KevinGossentCap could you also run vlocity cli again but with --verbose

image

I'm almost certain it won't show the errors I need because the compiler has its verbose prop hardcoded to false, but let's give it a try.

image

My guess is that one of these custom rest services is causing that system limit exception

image

Could you also open your debug logs and try to identify which apex method throws this exception while the compiler is running APEX_ERROR: System.LimitException: JSON string exceeds heap size limit

Hi again,
I tested verbose and not much additional information, either on screen or logfile.
On screen I only have an additional information (the Result json I'll paste at the end of this answer).
In the log I have nothing at all (not even the APEX error)

Here for the verbose output giving the additional result json and still the APEX error:

  LWC for FlexCard will be compiled at the end >> VlocityCard/cpqProductTileList
  Result >> {"Status":"Deleted","VlocityDataPackId":"a5d6S000001Eg9zQAC"}
  Salesforce Org >> sfi_esm_win23
  Version Info >> v1.16.1 vlocity_cmt 900.468
  Log File >> vlocity-temp\logs\vlocity-YAML-CPQ_LWC_3_test-yaml-2022-11-30T07-42-56-768Z-Deploy.yaml
  Current Status >> Deploy
  Remaining >> 0
  Success >> 2
  Error >> 0
  Elapsed Time >> 0m 53s
  Migrated 2 items >> Deploying
  Saving File Start
  Saving File End >> 119
  Checking Valid Imports Start
  Get Package Version
  Loading @vlocity-cme/flexcard-compiler@latest
  Compiling Flexcard with  FlexCard ID:  >> a5a6S000007JdoAQAS
APEX_ERROR: System.LimitException: JSON string exceeds heap size limit

(System Code)
    at HttpApi.getError (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\jsforce\lib\http-api.js:250:13)
    at C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\jsforce\lib\http-api.js:95:22
    at tryCallOne (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\promise\lib\core.js:37:12)
    at C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\promise\lib\core.js:123:15
    at flush (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\asap\raw.js:50:29)
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
  errorCode: 'APEX_ERROR'
}
Specified path does not exist. Creating it now...
  Deploying generated LWC components
  Using salesforce-alm
  Running source:convert
Using resolved username kevin.gossent-0586686738@industryapps.com from alias sfi_esm_win23

@AllanOricil
Copy link
Contributor

@KevinGossentCap this does not help. I don't have means to repro your error, so Im going to guide you so that we can at least discover which apex code is causing this exception you are seeing.

Do you know where theflexcard-compiler package is located, right? If not, it is in the root of your sfdx project, in the following dir vlocity-temp/plugins/@vlocity-cme/flxcard-compiler

Could you override a function called executeMethod in vlocity-temp/plugins/@vlocity-cme/flxcard-compiler/src/compiler/flexCardUtils/api.js using the one I pasted below.

function executeMethod(methodName, inputMap, params) {
  const data = {
    sClassName: _namespaceDotNotation + "FlexCardCompiler",
    sMethodName: methodName,
    input: inputMap ? JSON.stringify(inputMap) : "{}",
    options: inputMap ? JSON.stringify(inputMap) : "{}",
    ...params
  };

  console.log('executeMethod data');
  console.log(JSON.stringify(data));

  let url = `${_namespaceSlashNotation}/v1/GenericInvoke/`;
  
  if (_connection) {
    return _connection.apex.post(url, data, (err, res) => {
      if (err) {
        console.log(`Error while executing: ${methodName}`);
        return console.error(err);
      }
      return res;
    });
  }

  return Promise.reject(
    "Connection not set. Please do so using setApi method."
  );
}

Then run the cli again and see if it prints more error messages.

@KevinGossentCap
Copy link
Contributor

Hi @AllanOricil , here is the new output

  Loading @vlocity-cme/flexcard-compiler@latest
  Compiling Flexcard with  FlexCard ID:  >> a5a6S000007JdoAQAS
executeMethod data
{"sClassName":"vlocity_cmt.FlexCardCompiler","sMethodName":"getAllCardsByRecordType","input":"{\"recordType\":\"Flex\"}","options":"{\"recordType\":\"Flex\"}"}
executeMethod data
{"sClassName":"vlocity_cmt.FlexCardCompiler","sMethodName":"getLWCBundles","input":"{\"nextRecordsUrl\":\"\"}","options":"{\"nextRecordsUrl\":\"\"}"}
executeMethod data
{"sClassName":"vlocity_cmt.FlexCardCompiler","sMethodName":"getUserProfile","input":"{}","options":"{}"}
Error while executing: getAllCardsByRecordType
APEX_ERROR: System.LimitException: JSON string exceeds heap size limit

(System Code)
    at HttpApi.getError (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\jsforce\lib\http-api.js:250:13)
    at C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\jsforce\lib\http-api.js:95:22
    at tryCallOne (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\promise\lib\core.js:37:12)
    at C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\promise\lib\core.js:123:15
    at flush (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\node_modules\asap\raw.js:50:29)
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
  errorCode: 'APEX_ERROR'
}
executeMethod data
{"sClassName":"vlocity_cmt.FlexCardCompiler","sMethodName":"getCustomLabels","input":"{\"customLabels\":[\"CPQSeeDetailsLabel\",\"CPQPriceLabel\",\"OneTime\",\"Recurring\",\"CPQAddToCart\",\"CPQConfigure\",\"CPQOneTimeLabel\"]}","options":"{\"customLabels\":[\"CPQSeeDetailsLabel\",\"CPQPriceLabel\",\"OneTime\",\"Recurring\",\"CPQAddToCart\",\"CPQConfigure\",\"CPQOneTimeLabel\"]}"}
executeMethod data
{"sClassName":"vlocity_cmt.FlexCardCompiler","sMethodName":"upsertAttachment","input":"{\"sParentId\":\"a5a6S000007JdoAQAS\",\"sAttName\":\"a5a6S000007JdoAQAS.css\",\"sContent\":\"\",\"bEncoded\":false}","options":"{\"sParentId\":\"a5a6S000007JdoAQAS\",\"sAttName\":\"a5a6S000007JdoAQAS.css\",\"sContent\":\"\",\"bEncoded\":false}"}
Specified path does not exist. Creating it now...
  Deploying generated LWC components
  Using salesforce-alm
  Running source:convert
Using resolved username kevin.gossent-0586686738@industryapps.com from alias sfi_esm_win23

@AllanOricil
Copy link
Contributor

AllanOricil commented Nov 30, 2022

@KevinGossentCap

Now you can open a ticket to vlocity so that they can fix that apex method that is failing. 😄

u can't fix this apex class because it is inside a managed package.

@deanjesper
Copy link
Contributor

Hi @KevinGossentCap and @AllanOricill, the issue with the Apex class is due to be fixed in the next patch (240.9) which is due to be released around 9 December.

@KevinGossentCap
Copy link
Contributor

@AllanOricil I'm just hopping that, once the "new first error" is solved, the following will be fully tested to produce a version which can go through all omniscripts & vlocitycards provided with industry CPQ LWC + ESM...

@deanjesper
Copy link
Contributor

Yep sadly this issue is not fixed in 240.9. I have a case open and they're saying it will be fixed in 240.11. I won't hold my breath though. Please do raise cases and raise this as an issue as I'm sure a case from each customer will help push Salesforce to rethink their testing practices before releasing and getting our hopes up.

@KevinGossentCap
Copy link
Contributor

Hi @centricadean @AllanOricil @manas-sf , I've just tested with latest VBT and latest winter 23 patch (240.11).
Some of the more blocking errors are solved BUT there is a more problematic resulting issue now

  • Apex error not there anymore
  • localCompiled LWC are not the same as browser compile LWC

You can easily test using the SFI provided industry CPQ LWC.
The LWC are not exactly the same. There is even one that is so different that it doesn't even deploy...

@deanjesper
Copy link
Contributor

Hi @centricadean @AllanOricil @manas-sf , I've just tested with latest VBT and latest winter 23 patch (240.11). Some of the more blocking errors are solved BUT there is a more problematic resulting issue now

  • Apex error not there anymore
  • localCompiled LWC are not the same as browser compile LWC

You can easily test using the SFI provided industry CPQ LWC. The LWC are not exactly the same. There is even one that is so different that it doesn't even deploy...

Yep, sadly there are still issues with the local compiler. If you compile a Multi-Language FlexCard, then the labels aren't generated and just display as {Label.xxx} when you render the LWC.

I have no more updates from Salesforce on this. The saga continues...

@manas-sf
Copy link
Contributor

Thanks for the feedback. We have Case#35690448 with FlexCard team and they looking into it.

@deanjesper
Copy link
Contributor

@manas-sf there is also Case #43894399

@thvd
Copy link
Contributor

thvd commented Jan 16, 2023

@manas-sf and there is also case #43776753. Already closed, but not solved.

@deanjesper
Copy link
Contributor

@manas-sf and there is also case #43776753. Already closed, but not solved.

Closed but not solved - great!

@thvd
Copy link
Contributor

thvd commented Feb 15, 2023

Does anyone already run with 242? I have been told (tentative/safe harbour/...) it should have been solved in 242.
Did anyone test already?

@pawel-id
Copy link

pawel-id commented Mar 4, 2023

I would rephrase @thvd question: does anyone use local compilation? On which version if possible?

Reading this thread makes the impression that it just doesn’t work. I’m desperately searching for this possibility. We have huge Vlocity project (hundreds omniscripts, flex cards, etc). Currently we are on Spring’22 (900.456). In our case full deployment of just this Vlocity part takes 3-4 hours. And most of the deployment time it is compilation and activation of LWC stuff via puppeteer. Moreover it is very vulnerable to all network and Salesforce instabilities. Then it fails frequently. With growing project size we are approaching the moment where we won’t be able to deploy Vlocity at all. Then local compilation could solve the problem, but does it really work? Anyone?

@thvd
Copy link
Contributor

thvd commented Mar 4, 2023 via email

@KevinGossentCap
Copy link
Contributor

KevinGossentCap commented Mar 7, 2023

Not completely sure if it works as, if I follow my shared procedure

  • asking an ESM trial ORG
  • getting the industry CPQ LWC ressources
  • unzipping etc
  • launching deploy with everything and localCompile

We can see that there are A LOT of LWC not produced.
To really test, I'll have to produce a clean sandbox, full manually install vlocity managed package and then full manually do all CPQ LWC + ESM steps and then compare between trial ORG and produced sandbox...

@KevinGossentCap
Copy link
Contributor

Replying to myself, it still violently crashes when trying to use it for initial vlocity CME industry CPQ LWC deployment...

@KevinGossentCap
Copy link
Contributor

To sum it up

  • localCompile of industry CPQ LWC OmniScript crashes (there are only 18 of them...)
  • localCompile of industry CPQ LWC VlocityCard seem to create the LWCs (141 of them) but
    • if you let default "useSfdxCli: false" you get an very ugly saas error like months ago
    • if you specify "useSfdxCli: true" then it can't interpret or launch the convert do mdapi correctly and crashes
    • if you take the locally produced LWCs to manually convert them it works
    • if you deploy them afterwards the deployment is miraculously working (I'm yet to try comparing between locally compiled and browser compile for some of the LWCs... takes some time)

@AllanOricil
Copy link
Contributor

AllanOricil commented Mar 7, 2023

@KevinGossentCap can you share the repository and the sfdx cli you used when you set "useSfdxCli" to true? I will take a look and fix it

@KevinGossentCap
Copy link
Contributor

@AllanOricil

  • I used a SFDC spring23 sandbox without SFI
  • made the pre-install steps
  • installed latest vlocity CME (242.6.900.480) and followed post-install steps
  • components are directly taken from managed package static resources (if you only want to know where to find them here is the sub-guide https://help.salesforce.com/s/articleView?id=ind.comms_copy_datapacks_to_migrate_3.htm&language=en_US&type=5)
  • my personal SFDX-CLI version is latest-rc so 7.191.3 (but it was the same I think with previous ones)
  • my personal vlocity CLI version is latest so 1.17.1

@AllanOricil
Copy link
Contributor

AllanOricil commented Mar 7, 2023

@KevinGossentCap
Could you share the error message u see when "useSfdxCli=true". I need information to determine why the metadata convertion step fails when running the sfdx command inside vlocity_build, but not when you manually convert it.

@KevinGossentCap
Copy link
Contributor

KevinGossentCap commented Mar 7, 2023

I ran the command with verbose option (just in case)

Compiling Flexcard with  FlexCard ID:  >> a7s7Z0000008n0OQAQ
Specified path does not exist. Creating it now...
  Deploying generated LWC components
  Using sfdx cli
  Running source:convert
  Error: Error parsing stdout
    at _run (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\lib\sfdx.js:11:9)
    at _sourceConvert (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\lib\sfdx.js:28:9)
    at run (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\lib\sfdx.js:37:10)
    at DataPacksJob.deployJob (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\lib\datapacksjob.js:2796:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async DataPacksJob.doRunJob (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\lib\datapacksjob.js:339:9)
    at async DataPacksJob.runJobWithInfo (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\lib\datapacksjob.js:293:9)
    at async DataPacksJob.runJob (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\lib\datapacksjob.js:95:26)
    at async Vlocity.runDataPacksCommand (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\lib\vlocity.js:173:16)
    at async VlocityCLI.runJob (C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\lib\vlocitycli.js:725:12)
  Saving File Start
  Saving File End >> 149

@KevinGossentCap
Copy link
Contributor

@AllanOricil One information is that it's been 1 or 2 weekly release of SFDX-CLI that salesforce-alm is not used or present anymore.
That might be it.
Maybe the right time to try not pointing to package but only pure commands or the SFDX-CLI API

@AllanOricil
Copy link
Contributor

AllanOricil commented Mar 7, 2023

@KevinGossentCap could you please run this command.

FORCE_COLOR=0 sfdx force:source:convert --rootdir "${rootdir}" --outputdir "${outputdir}" --json

rootdir has to be the temp directory where your flexicard lwcs are. The lwc are probably in the vloctiy_tmp dir that is located in the root of ur sfdx project.

outputdir can be anywhere you want to store the converted lwcs

Save the output of this command to a file and post it here, please.

The convertion is failing because it can't convert the json output. But this error shouldn't have stopped the convertion because it wrapped with a try/catch. This means that sfdx is not actually converting anything. Now we need to know exactly why sfdx can't convert your lwc from source to md.

@KevinGossentCap
Copy link
Contributor

I'll try but I suspect it won't work as setting parameters before the command work only on unix/linux and not on windows

@KevinGossentCap
Copy link
Contributor

KevinGossentCap commented Mar 7, 2023

Here it is, as I suspected

 ~#@❯  FORCE_COLOR=0 sfdx force source convert -d .\vlocity-temp\mdapi2\ -r .\vlocity-temp\tempDeployLWC\salesforce_sfdx\ --json                                                                                                                                                                   ❮  9m 38s 858ms   
FORCE_COLOR=0: The term 'FORCE_COLOR=0' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

@KevinGossentCap
Copy link
Contributor

@AllanOricil you'll have to make it more generic with getting if env var exists, and if yes save back the value, then set your value, then put back the initial status of the env var

@AllanOricil
Copy link
Contributor

AllanOricil commented Mar 7, 2023

Here it is, as I suspected

 ~#@❯  FORCE_COLOR=0 sfdx force source convert -d .\vlocity-temp\mdapi2\ -r .\vlocity-temp\tempDeployLWC\salesforce_sfdx\ --json                                                                                                                                                                   ❮  9m 38s 858ms   
FORCE_COLOR=0: The term 'FORCE_COLOR=0' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

@KevinGossentCap that might be the reason for you issue. I recommend you run vlocity on a container image based on Linux until that is fixed.

Use this image #572

Or any other image that is based on Linux.

@KevinGossentCap
Copy link
Contributor

@AllanOricil no can do. for many security policy reasons it's not an option.
We have to maintain windows OS compatibility for the CLI

@AllanOricil
Copy link
Contributor

AllanOricil commented Mar 7, 2023

@AllanOricil no can do. for many security policy reasons it's not an option.
We have to maintain windows OS compatibility for the CLI

@KevinGossentCap
I will see if I can open a PR. But it won't be released sooner. You can open the file where the error is thrown in your computer (the error message displays exactly which file throws the exception), then remove that FORCE_COLOR parameter from the _run function. After that, run vlocity build again, and post the output here.

This is the location for you

C:\KGO_Tools\node-v18-win-x64\node_modules\vlocity\lib\sfdx.js

@KevinGossentCap
Copy link
Contributor

I think we can make it work as it should with this kind of inspiration : https://stackoverflow.com/questions/58805784/node-js-how-to-pass-environment-variables-with-a-shell-command
especially with the answer to help : https://stackoverflow.com/posts/58806874/revisions

@KevinGossentCap
Copy link
Contributor

@AllanOricil @thvd with modification to local as indicated in my comment to @thvd 's PR, it makes even OmniScript localCompile work 🎊

@AllanOricil
Copy link
Contributor

It is time for implementing integration tests with the following inputs to avoid these little mistakes

  • node 14 and 16
  • sfdx latest, rc, previous versions
  • os: Darwin, Linux, windows
  • few job file samples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants