vlocity_build: ReferenceError: sessionStorage is not defined

Summary

When using local compile, a sessionStorage is not defined error appears when trying to compile Industries CPQ LWC cart FlexCards.

The error appears to be related to this file: /vlocity-temp/plugins/@vlocity-cme/flexcard-compiler/src/compiler/flexCardUtility/fetchCustomLabels.js

Commenting out the sessionStorage lines allows the FlexCards to compile but then they error in Salesforce:

Screenshot 2022-07-27 at 2 23 59 pm

Steps to reproduce:

  1. Set the job file to use the vlocity-cme compiler (make sure you include your npm auth key):
lwcCompilerVersion: "900"
lwcCompilerNamespace: "vlocity-cme"
  1. Make sure you have the VlocityCard folder with the LWC cart FlexCards (follow instructions here to download from Static Resources https://docs.vlocity.com/en/Deploy-Industries-CPQ-in-LWC-with-OmniStudio-Disabled.html)

  2. Run packDeploy

  3. If you get an error with copy-anything, use @2.0.1 or @2.0.6 - if you use @2.0.6, see here https://github.com/vlocityinc/vlocity_build/issues/475#issuecomment-1196604605

  4. Run packDeploy again, it will compile some FlexCards and then it will give you an error saying ReferenceError: sessionStorage is not defined

Screenshot 2022-07-27 at 1 40 02 pm

Running vlocity 1.15.6 in the vlocity_cmt namespace

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (13 by maintainers)

Most upvoted comments

@AllanOricil @thvd , since VBT 1.16, it’s using latest to get latest version of omiscript & flexcard compilers. So here we have vlocity/Salesforce provided components that have been “fixed” from “sessionStorage” issue but not tested to the point of knowing if there are further errors down the road while using localCompile on their own provided components.

I really say vlocity/Salesforce provided components because I’m directly testing with “industry CPQ LWC” components. I’d have to test with ESM components but I will not before it’s solved for industry CPQ ones and I expect the solution provider to test it to the end.

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

@agarcia-sf we have removed the use of SessionStorage on flexcard PR: https://github.com/sf-industries/via_cards/pull/465/files from 240 a while base when @centricadean mentioned CASE 43467130, Any idea why @vlocity-cme still has old codes.

@agarcia-sf thank you - yes the issue is still alive and kicking in the latest version of VBT and with v240. I raised another issue outlining what I found to be broken in the @vlocity-cme plugin which is in the Vlocity repo. Please see issue https://github.com/vlocityinc/vlocity_build/issues/520

So there are two outstanding issues:

  • @vlocity-cme plugin
  • /v1/GenericInvoke API method is still broken in v240 (which was supposed to be fixed as per GUS)

@centricadean I’ve been told trough a Salesforce Case that this error is to be corrected with version 240 (winter 23). We’ll see how it will arrive, and if we can use it or not with previous versions of the managed package (like using the 240 compiler for the 236 managed package…)

Even easier way to reproduce

  1. Ask for an ESM trail org : https://success.vlocity.com/s/application-suite-detail?Id=a443m0000006rxkAAA&library=aBQo0000000PAsRGAW (I used 236.2.4)
  2. sfdx connect to it
  3. download, unzip and regroup components from CPQ static resources: CPQ_browse_flexcards, CPQ_cart_flexcards, CPQ_common_flexcards, CPQ_config_flexcards, CPQ_multisite_flexcards, CPQ_DR_IP_OS, and CPQ_assets_flexcards
  4. build your YAML file with parameters to point to the right directory & npmAuthKey & lwcCompilerVersion
  5. Manifest in YAML can be limited to OmniScript/CPQ_cartConfigurator_Multi-Language & VlocityCard/cpqProductTileList
  6. run the command (in my case “vlocity -propertyfile .\vlocity\properties\vlocity.properties -job .\vlocity\YAML\CPQ_LWC_3.yaml packDeploy” ; I use propertyfile to give sf.username)
  7. See the crash (if you get the copy-anything error, prefer replace the retrieved one with version 2.0.1 and relaunch same command)