sfpowerkit
sfpowerkit copied to clipboard
sfpowerkit:source:profile:reconcile -s removes user license details
sfdx sfpowerkit:source:profile:reconcile -s
removes <userLicense>
tag from profiles. As a result, all profiles after deploying have default Salesforce license, that is incorrect for some of them. The bug is critical while deploying all the metadata including custom profiles at the first time to scratch orgs.
To Reproduce
- Retrieve any profile (e.g. Admin) from production or sandbox org:
sfdx sfpowerkit:source:profile:retrieve -n Admin -u user
- Ensure profile has
<userLicense>Salesforce</userLicense>
tag - Reconcile using the source:
sfdx sfpowerkit:source:profile:reconcile -s -n Admin
Expected behavior
Reconciled profile should have the same tag <userLicense>
as we have in the full version of the retrieved profile.
Desktop:
- OS: Microsoft Windows [Version 10.0.19044.1766]
- sfdx-cli/7.151.1 win32-x64 node-v14.18.2
- Version of sfpowerkit 4.2.11
Thanks @loktevich for raising this. The reconcile works also on license. That means that if the license does not exist in the target org, then the tag will be removed. Can you check if the license being removed exist in the targe org? Sometimes you might need to match production licenses (From the Company information page) in a Sandbox to have all licenses available in production.
Hello, @genoud. reconcile -u username
works as expected, but that problem with removing licenses exists only for the reconcile
command with -s parameter. So, we use just the source for reconciling, not any org.
@loktevich I found the issue. Can you test the change in the PR?
Hi Genoud @genoud , no luck. Am I doing everything correctly ?
preps:
cd sfpowerkit
git fetch
git checkout issue/713
sfdx plugins:unlink
rm -rf node_modules
npm i
sfdx plugins:link
execution:
cd ../my_project
sfdx sfpowerkit:source:profile:reconcile -n Admin -s
-------------------------------------------------------------------------------------------
sfpowerkit -- The DX@Scale Developer Toolkit - Version:4.2.10 - Release:May 22
-------------------------------------------------------------------------------------------
Profiles Found in Project Directory 1
Initiated Profile reconcile thread :1 with a chunk of 1 profiles
Profiles queued in thread :1 :
[{"path":"profiles\\profiles\\Admin.profile-meta.xml","name":"Admin"}]
Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in
TS itself.
An error occured during profile reconcile. You can rerun the command after a moment.
Worker stopped with exit code 1
Hi Genoud @genoud , no luck. Am I doing everything correctly ?
preps:
cd sfpowerkit git fetch git checkout issue/713 sfdx plugins:unlink rm -rf node_modules npm i sfdx plugins:link
execution:
cd ../my_project sfdx sfpowerkit:source:profile:reconcile -n Admin -s ------------------------------------------------------------------------------------------- sfpowerkit -- The DX@Scale Developer Toolkit - Version:4.2.10 - Release:May 22 ------------------------------------------------------------------------------------------- Profiles Found in Project Directory 1 Initiated Profile reconcile thread :1 with a chunk of 1 profiles Profiles queued in thread :1 : [{"path":"profiles\\profiles\\Admin.profile-meta.xml","name":"Admin"}] Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself. An error occured during profile reconcile. You can rerun the command after a moment. Worker stopped with exit code 1
I'm not facing this issue on my end. Can you follow the solutions proposed here https://stackoverflow.com/questions/72488958/false-expression-non-string-value-passed-to-ts-resolvetypereferencedirective
Thanks,
Hi Genoud @genoud,
To avoid any side effects of local environment, I've tried to install it in docker container node:14.18-buster-slim
Manually installed all the components there, but no luck. The error is a bit different though:
[object Object]
An error occured during profile reconcile. You can rerun the command after a moment.
The same error I'm getting on Windows installation after npm install ts-node-dev@latest ts-node@latest
Below is full preps and log that can be repeated. Can you please try it out ?
$ docker run -it --rm -v $PWD/..:/build -w /build node:14.18-buster-slim /bin/bash
# apt-get update && apt-get install git
# npm install --global sfdx-cli
# sfdx --version
sfdx-cli/7.161.0 linux-x64 node-v14.18.3
# cd /build/sfpowerkit/
# git log -1
commit 914c8fabf06df4fdb084063fb7eacb0c5680cbdb (HEAD -> issue/713, origin/issue/713)
# git status
On branch issue/713
Your branch is up to date with 'origin/issue/713'
# git clean -dxf
Removing lib/
Removing node_modules/
Removing npm-shrinkwrap.json
Removing oclif.manifest.json
Removing tsconfig.tsbuildinfo
# npm i
# sfdx plugins:link
# cd ../my_project
# sfdx sfpowerkit:source:profile:reconcile -n Admin -s
-------------------------------------------------------------------------------------------
sfpowerkit -- The DX@Scale Developer Toolkit - Version:4.2.10 - Release:May 22
-------------------------------------------------------------------------------------------
Profiles Found in Project Directory 1
Initiated Profile reconcile thread :1 with a chunk of 1 profiles
Profiles queued in thread :1 :
[{"path":"profiles/profiles/Admin.profile-meta.xml","name":"Admin"}]
[object Object]
An error occured during profile reconcile. You can rerun the command after a moment.
Worker stopped with exit code 1
Can you run it with trace flag?
Not much more, here it is:
# sfdx sfpowerkit:source:profile:reconcile -s --loglevel=trace
-------------------------------------------------------------------------------------------
sfpowerkit -- The DX@Scale Developer Toolkit - Version:4.2.10 - Release:May 22
-------------------------------------------------------------------------------------------
ProfileList []
Project Directories ["resources","force-app","portals","profiles"]
Profiles Found in Project Directory 25
Initiated Profile reconcile thread :1 with a chunk of 1 profiles
Profiles queued in thread :1 :
[{"path":"profiles/profiles/Admin.profile-meta.xml","name":"Admin"}]
[object Object]
An error occured during profile reconcile. You can rerun the command after a moment.
Worker stopped with exit code 1
Taking a look at this linking issue today
Thanks @Caitlyn-Mills @genoud Seems linking issue fixed and the initial bug is fixed too. I've linked it on node 14.18. License details were not removed with profile:reconcile -s.
Hi @Caitlyn-Mills @genoud
If the fix is ok from your side, can you please estimate when the released version with this fix may be available ?
Thanks
Can this fix also be packed into upcoming release ? It works. Thanks.
We have pushed the fix in the 5.0.0 release. Thanks for raising the issue.