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

Omniscript compiler fails even with Puppeteer installed #549

Open
irfanlai opened this issue Dec 23, 2022 · 20 comments
Open

Omniscript compiler fails even with Puppeteer installed #549

irfanlai opened this issue Dec 23, 2022 · 20 comments

Comments

@irfanlai
Copy link

Getting the following error when deploying and activating Vlocity datapacks with VBT. I have puppeteer installed in the deployment YAML.
Vlocity ver: [email protected]
Puppeteer ver: [email protected]

"An error occurred while loading OmniScript compiler: Error: Failed to get package '@vlocity-cme/omniscript-lwc-compiler' Response error 401 Unauthorized - If you are using Puppeteer for LWC compilation this error can be ignored."

@deanjesper
Copy link
Contributor

Happy New Year @irfanlai

You need to raise a case with Salesforce to get your NPM key for the Vlocity repo. Once you have this, add it into your job file as per the instructions on the readme :)

@irfanlai
Copy link
Author

@centricadean We have Github actions for our Vlocity deployment. Where should I be adding the NPM key? Not able to figure it out from the instructions.

@deanjesper
Copy link
Contributor

@irfanlai, you need to add it to your YAML job file, like so:

projectPath: .
activate: true
expansionPath: vlocity
npmAuthKey: KEYHERE
npmRepository: 'https://repo.vlocity.com/repository/vlocity-public/'

@irfanlai
Copy link
Author

irfanlai commented Mar 2, 2023

@centricadean Thanks for the job file example. I added the npm repo key and when we tested with omniscript, it deployed but it failed when compiling the LWC component with the below error. Any idea what is missing?
I have added the job file that we are using and also the error below.

projectPath: ./vlocity
activate: true
autoRetryErrors: true
supportHeadersOnly: false
npmAuthKey: KEYHERE
npmRepository: 'https://repo.vlocity.com/repository/vlocity-public/'
gitCheck: true
queries:
Adding to Deploy >> OmniScript/Update_DealSetup_English - Update_DealSetup_English    
  Deploy >> 1 Items  
  Deploying >> OmniScript/Update_DealSetup_English  
  Result >> {"Finished":0,"Total":1,"Message":"Ready","Status":"Ready","VlocityDataPackId":"a5W7j000000LBfREAW","VlocityDataPackProcess":"Import"}  
  Result >> {"Finished":1,"Total":1,"Message":"Complete","Status":"Complete","VlocityDataPackId":"a5W7j000000LBfREAW","VlocityDataPackProcess":"Import"}  
  Deploy Success >> OmniScript/Update_DealSetup_English Deal Setup 1   
  Result >> {"VlocityDataPackId":"a5W7j000000LBfREAW","VlocityDataPackKeysToActivate":["ALL"],"Total":0,"Finished":0,"VlocityDataPacksActivated":[],"Status":"Complete","error":"OK","errorCode":"INVOKE-200","activationSuccess":[{"VlocityDataPackKey":"OmniScript/Update_DealSetup_English"}]}  
  Activated >> OmniScript/Update_DealSetup_English  
  Get Package Version  
  Loading @vlocity-cme/omniscript-lwc-compiler@latest  
  Starting OmniScript LWC Compilation >> OmniScript/Update_DealSetup_English (a307j000000ThN6AAK)  
  Retrieving OmniScript definition  
  Compiling OmniScript LWC Component  
Specified path does not exist. Creating it now...
  Parent OmniScript (OmniScript/PreOpportunityScreens_PreOpportunityScreens_English) for Reusable OmniScript (OmniScript/Update_DealSetup_English) will be compiled at the end  
  Result >> {"Status":"Deleted","VlocityDataPackId":"a5W7j000000LBfREAW"}  
  Salesforce Org >> ***  
  Version Info >> v1.17.0 vlocity_cmt 900.452  
  Log File >> vlocity-temp/logs/buildfiles/deploy_to_qa-yaml-2023-03-02T20-20-53-698Z-Deploy.yaml  
  Current Status >> Deploy  
  Error >> 0  
  Remaining >> 0  
  Success >> 1  
  Elapsed Time >> 0m 33s  
  Saving File Start  
  Saving File End >> 384  
  Checking Valid Imports Start  
  Parent OmniScripts to Compile >> [
    "OmniScript/PreOpportunityScreens_PreOpportunityScreens_English"
]  
  Starting Parent OmniScript LWC Activation >> Number of OmniScript to Activate: 1  
  Get Package Version  
  Starting OmniScript LWC Compilation >> OmniScript/PreOpportunityScreens_PreOpportunityScreens_English (a304w00000WhyLNAAZ)  
  Retrieving OmniScript definition  
  Compiling OmniScript LWC Component  
Specified path does not exist. Creating it now...
  Deploying generated LWC components  
  Using salesforce-alm  
  Running source:convert  
Using specified username ***

  {
    "name": "UnexpectedFileFound"
}  
  UnexpectedFileFound: Unexpected file found in package directory: /home/runner/work/salesforce-ses/salesforce-ses/force-app/main/default/ChannelObjectLinkingRules/Match_phone_number_to_record_1623529206154.ChannelObjectLinkingRule-meta.xml

@deanjesper
Copy link
Contributor

I've not seen that error before @irfanlai, you might need to raise a Salesforce case for that. I've noticed that you're on 900.452 which is quite out of date. Support will want you to upgrade to the latest package. You could give that a go first, and then if it still doesn't work, raise the case.

@irfanlai
Copy link
Author

irfanlai commented Mar 3, 2023

Thanks for your quick reply. I rolled back the change but now every time an OS is getting deployed we are getting this error.
I raised a bug in VBT here. I will close it for now and raise a case with Salesforce.

@irfanlai
Copy link
Author

irfanlai commented Mar 3, 2023

I've not seen that error before @irfanlai, you might need to raise a Salesforce case for that. I've noticed that you're on 900.452 which is quite out of date. Support will want you to upgrade to the latest package. You could give that a go first, and then if it still doesn't work, raise the case.

If 900.452 is out of date what should it be and does Salesforce update this or we have to do it?

@irfanlai
Copy link
Author

irfanlai commented Mar 27, 2023

We raised the case with Salesforce and the response was to check the file which is in the logs.
The file in question is not even being used in the deploying datapacks. I see that the file shows in VSCode but not in Github code.
So the question is does VBT checks for any git file discrepancies or it checks if all files in the repo are in good state, no git error etc?

'UnexpectedFileFound: Unexpected file found in package directory: /home/runner/work/salesforce-ses/salesforce-ses/force-app/main/default/ChannelObjectLinkingRules/Match_phone_number_to_record_1623529206154.ChannelObjectLinkingRule-meta.xml'

@irfanlai
Copy link
Author

irfanlai commented Apr 3, 2023

Does anyone know if VBT checks for file issues in the repo? Every time we delete the file mentioned in error in the next run we get a new file with the error.

Below is the latest log.

Deploying generated LWC components  
  Using salesforce-alm  
  Running source:convert  
Using specified username ***

  {
    "name": "UnexpectedFileFound"
}  
  UnexpectedFileFound: Unexpected file found in package directory: /home/runner/work/salesforce-ses/salesforce-ses/force-app/main/default/audience/AcctWithMultipleBillingAccounts.audience-meta.xml
    at Workspace.isValidSourcePath (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:165:35)
    at Workspace.handleArtifact (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:148:18)
    at async Workspace.walk (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:138:36)
    at async Workspace.walk (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:140:17)
    at async Workspace.walk (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:140:17)
    at async Workspace.walk (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:140:17)
    at async Workspace.walkDirectories (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:125:13)
    at async Workspace.initializeStateFull (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:95:9)
    at async Workspace.init (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:47:17)
    at async Workspace.create (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/@salesforce/core/node_modules/@salesforce/kit/lib/creatable.js:31:9)
    at async SourcePathStatusManager.init (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/sourcePathStatusManager.js:161:26)
    at async SourcePathStatusManager.create (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/@salesforce/kit/lib/creatable.js:20:9)
    at async SourceWorkspaceAdapter.init (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/sourceWorkspaceAdapter.js:61:21)
    at async SourceWorkspaceAdapter.create (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/@salesforce/kit/lib/creatable.js:20:9)
    at async SourceConvertApi.initWorkspaceAdapter (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/sourceConvertApi.js:53:43)
    at async SourceConvertApi.doConvert (/home/runner/sfdx/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/sourceConvertApi.js:59:9)  
  Saving File Start  
  Saving File End >> 547  
  Retrying Deployment  
  Finalizing Deployment  
  Finalizing Deployment  
  Salesforce Org >> ***  
  Error >> 0  
  Version Info >> v1.17.1 vlocity_cmt 900.452  
  Log File >> vlocity-temp/logs/buildfiles/deploy_to_qa-yaml-2023-04-03T16-50-51-922Z-Deploy.yaml  
  Current Status >> Deploy  
  Remaining >> 0  
  Success >> 18  
  Elapsed Time >> 2m 0s  
  Migrated 18 items >> Deploying  
  Formatting Response >> Deploy  
  DataRaptor/GetOrderEFL >> Success  
  DataRaptor/US_GetMatrixData >> Success  
  DataRaptor/US_UpsertCommodityOrderProduct >> Success  
  IntegrationProcedure/Customer_RenewalCreateInitialOrder >> Success  
  IntegrationProcedure/Enrollment_GetProductsforEnrollments >> Success  
  IntegrationProcedure/Enrollment_Products >> Success  
  IntegrationProcedure/Enrollment_RenewContract >> Success  
  IntegrationProcedure/Enrollment_UpsertCommodityOrderProduct >> Success  
  IntegrationProcedure/Generate_PlanDocument >> Success  
  IntegrationProcedure/Renew_ProcessPlansEFL >> Success  
  OmniScript/AgentServices_RenewContract_English >> Success  
  OmniScript/Customer_RenewContract_English >> Success  
  OmniScript/Enrollment_AddServiceAddress_English >> Success  
  OmniScript/Plan_URL_English >> Success  
  VlocityCard/US_ProductSelect >> Success  
  VlocityCard/ViewPlanURL >> Success  
  VlocityCard/ViewPlanURL_DataTable >> Success  
  VlocityCard/ViewPlanURL_DataTableChild >> Success  
  Saving File Start  
  Saving File End >> 829  
  Job Complete >> Deploy 2m 0s  
Deploy error:
Exception while deploying compiled LWC components:
{
  "name": "UnexpectedFileFound"
}
Error: Process completed with exit code 1.

@pawel-id
Copy link

same here on latest VBT v1.17.2. 100% reproducible. The file which is reported as 'unexpected' is not Vlocity related. It is regular Salesforce metadata in sibling folder. It seems that for some reason VBT is trying to apply convert operation on files outside of its scope.

  Salesforce Org >> sc1  
  Version Info >> v1.17.2 vlocity_cmt 900.456  
  Current Status >> Deploy  
  Remaining >> 0  
  Success >> 1  
  Error >> 0  
  Elapsed Time >> 0m 30s  
  Deploying generated LWC components  
  Using salesforce-alm  
  Running source:convert  
  {
    "name": "UnexpectedFileFound"
}  
  UnexpectedFileFound: Unexpected file found in package directory: /Users/pawel/wrk/spartakus/navio/navio/force-app/self-service/audience/Billing_Account.audience-meta.xml
    at Workspace.isValidSourcePath (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:165:35)
    at Workspace.handleArtifact (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:148:18)
    at async Workspace.walk (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:138:36)
    at async Workspace.walk (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:140:17)
    at async Workspace.walk (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:140:17)
    at async Workspace.walkDirectories (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:125:13)
    at async Workspace.initializeStateFull (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:95:9)
    at async Workspace.init (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:47:17)
    at async Workspace.create (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/@salesforce/core/node_modules/@salesforce/kit/lib/creatable.js:31:9)
    at async SourcePathStatusManager.init (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/sourcePathStatusManager.js:161:26)
    at async SourcePathStatusManager.create (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/@salesforce/kit/lib/creatable.js:20:9)
    at async SourceWorkspaceAdapter.init (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/sourceWorkspaceAdapter.js:61:21)
    at async SourceWorkspaceAdapter.create (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/@salesforce/kit/lib/creatable.js:20:9)
    at async SourceConvertApi.initWorkspaceAdapter (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/sourceConvertApi.js:53:43)
    at async SourceConvertApi.doConvert (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/sourceConvertApi.js:59:9)
    at async SourceConvertCommand.execLegacyCommand (/Users/pawel/.nvm/versions/node/v18.16.0/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/ToolbeltCommand.js:148:29)
...

We were trying to use useSfdxCli: true which makes that error is not happening, but it leads to another issues which are out of scope of this ticket.

@jfaderanga
Copy link

also affected by this error.

Deploying generated LWC components Using salesforce-alm Running source:convert { "name": "UnexpectedFileFound" } UnexpectedFileFound: Unexpected file found in package directory: /opt/atlassian/pipelines/agent/build/force-app/main/default/audience/Business.audience-meta.xml at Workspace.isValidSourcePath (/usr/local/lib/nodejs/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:165:35) at Workspace.handleArtifact (/usr/local/lib/nodejs/lib/node_modules/vlocity/node_modules/salesforce-alm/dist/lib/source/workspace.js:148:18)

The issue seems to be happening only when deploying an OmniScript with changes on it..

@AllanOricil
Copy link
Contributor

If u share an sfdx project with the problem I can repro and try to fix the cli. Right now it is impossible.

@jfaderanga
Copy link

I raised a case to Vlocity support and they confirmed that this is indeed a scope conflict.

the vlocity plugin referenced the default path set in sfdx-project.json which is usually set to force-app, changing it to vlocity-temp/tempDeployLWC/salesforce_sfdx fixes the issue.

Only change the path when pipeline run so it won't affect local development with default force-app directory.

Add this snippet in your yaml file before running the packDeploy

sed -i.bak -e "s/force-app/vlocity-temp\/tempDeployLWC\/salesforce_sfdx/g" "sfdx-project.json"
rm sfdx-project.json.bak

just ensure you don't commit the changes..

@AllanOricil
Copy link
Contributor

AllanOricil commented Jul 9, 2023

try adding projectPath: . to your job file. I dont have to do any changes on the sfdx-project.json and it works as expected.

@jfaderanga
Copy link

projectPath in the job file is the directory where the vlocity components are saved, you just don't change it to the .

@AllanOricil
Copy link
Contributor

AllanOricil commented Jul 11, 2023

I think I understood what is happening now. I can fix it if sf assigns someone to review and approve PRs...

When the source convertion command runs, salesforce-alm verifies if all source files in the current workspace are valid, even when we are only interested in converting lwc. Because this package is older and it does not know about new metadata files that can be in the source format, an exception is thrown.

Read these lines to understand the problem:

workspace.isValidSourcePath:
https://github.com/forcedotcom/salesforce-alm/blob/main/src/lib/source/workspace.ts#L202-L221

IsValidSourcePath:
https://github.com/forcedotcom/salesforce-alm/blob/main/src/lib/source/metadataRegistry.ts#L584-L627

Metadata defs:
https://github.com/forcedotcom/salesforce-alm/blob/main/src/lib/source/metadataRegistry.ts#L267-L276

Possible solutions:

  • switch cwd to be inside the vloctiy temp folder before running salesforce-alm command.
  • change salesforce-alm to one of the new plugins that do the source convertion
  • update metadataTypeInfos.json with the updated list of possible metadata types. This file is somehow located in this path relative to metadataRegistry.ts from salesforce-alm path.join(__dirname, '..', '..', '..', 'metadata', 'metadataTypeInfos.json' not sure how this is added. Maybe it is downloaded by another package since I could not find it inside salesforce-alm

@sbutterfield

@AllanOricil
Copy link
Contributor

I remember I allowed devs to use their host sfdx cli to let them use the new updates of the source convertion command. It was kind of a hack I did to avoid having to manage another dependency.

@jfaderanga
Copy link

nice, yeah the metadataTypeInfos are in the metadataRegistry.ts, was hard-coded all in there. The first option would be a nice quick fix, it totally separate the scope of the vlocity components. It will not throw the error even if Salesforce release a new metadata type which extension results to invalid when isValidSourcePath runs.

@irfanlai
Copy link
Author

irfanlai commented Aug 4, 2023

Just checking this thread after a long time, finally there has been updates here so I am not the only one having this issue.

@AllanOricil Do you have a fix for this? I need this so very urgently as whenever we have an OS deployment using GIT, we have to manually go and activate them and it takes a good amount of time for us.

@AllanOricil
Copy link
Contributor

AllanOricil commented Aug 4, 2023

If salesforce hires my company's services I can give maintenance on this cli 😎🤓🥸

LET'S DO A DEAL!

I bet people here need my awesome js skills, right? just saying...

@sbutterfield

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

No branches or pull requests

5 participants