Closed tehnrd closed 1 year ago
@gbockus-sf If I'm understanding correctly, this is likely due to the following update ?
This issue has been linked to a new work item: W-12446404
Just to be clear, sfdx
cli used directly is working as expected, but trying to save a file in VSCode or push sources files in VSCode with the command palette is not replacing the secrets.
I was under the impression this string replacement code was added to SDR, and VSCode extension uses SDR, so the string replacement should work in VSCode as well.
RE: W-12446404, is this work item only to investigate? Or has this issue been confirmed as a bug?
Correct. The functionality was added to SDR. The WI is to update SDR to pick up the version that includes the change (and verify it behaves as expected when used in the VSCode context). We have to update the SF dependancies with care b/c it's a tangled web where an SDR upgrade likely comes with a @salesforce/core upgrade which means other deps that we have (like templates and apex) must also be the same version of core.
Got it, thanks for the insight!
Sorry if this is not the right place, what is SDR?
@pgonzaleznetwork No worries...we love us some acronyms around here. SDR is just the short way of saying the source-deploy-retrieve library shared between sfdx and the Salesforce VSCode Extensions. https://github.com/forcedotcom/source-deploy-retrieve
UPDATE: upgraded global install of sf cli, restarted vscode, and appears to be working now. 👍🏻
It seems like it is still not working in VSCode.
Is there an ETA on updating the underlying SDR library?
For ISV's this is an incredibly helpful feature that we can't use.
HI @tehnrd The SDR library has been updated and should support this functionality in VSCode. The associated work item was closed back in June of 2023. If it's not working for you please let us know the current details
Thanks!
@gbockus-sf It is working. It was me not understanding how it works.
I was setting env vars in the CLI with export VAR=value
but this was not being applied on deployment. This is because behind the scenes SDR spins up a new process/terminal which doesn't apply the values.
I modified my .zprofile
file with the env vars, and it is working now. I also had to restart VSCode for the new values to get pulled in, but I need to do more testing on this part to confirm if VSCode restart is actually required.
Summary
The new string replacements functionality is not working when files are saved and deployed in VSCode, or when the command palette Push Source commands are run.
https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_string_replace.htm
Steps To Reproduce:
Make sure the setting Salesforcedx-vscode-core › Push-or-deploy-on-save is enabled.
Setup a replacements config in sfdx-project.json file.
Save the file, or push the source with the command palette action.
Expected result
The values should be replaced when deployed to Salesforce.
Actual result
The values are not replaced, and the template strings are deployed instead.
Additional information
Salesforce Extension Version in VS Code: v56.14.0
SFDX CLI Version: sfdx-cli/7.182.1 darwin-x64 node-v18.12.1
OS and version: MacOS Monterey 12.3.1