Salesforcedx-vscode: SFDX: diff file against org

Created on 23 Aug 2019  Â·  11Comments  Â·  Source: forcedotcom/salesforcedx-vscode

Summary

I updated Salesforces extensions for vsCode and I installed "sfdx-diff" (https://forcedotcom.github.io/salesforcedx-vscode/articles/user-guide/source-diff). When I tried the "SFDX: diff file against org" on an apex class connected to a dev org, I had this error : "TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined".
But It works on the UAT or on the production org of the same project...
It works also on the dev org of another project.

Steps To Reproduce:

  1. Reload extensions to be updated in VsCode.
  2. Run "sfdx plugins:install @salesforce/sfdx-diff" in terminal inside vsCode.
  3. Result @salesforce/sfdx-diff... installed v0.0.2
  4. Try right-click and "SFDX: diff file against org" on an apex class.

Expected result

I should be able to make a diff between my local changes and my org.

Actual result

Error and no diff displayed.

Additional information

_Feel free to attach a screenshot_.
image

Statck with loglevel info: "stack": "Error: The file that you tried to diff isn't in a package directory that's specified in your sfdx-project.json file. Add this location to your \"packageDirectories\" value, or diff a different file. For details about sfdx-project.json, see: https:/e. For details about sfdx-project.json, see: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm\n at Function.isValidPackageSource (C:\\Users\\xxxx\\AppData\\Lo\\validations.js:29:19)\nOuter stack:\n at Functical\\sfdx\\node_modules\\@salesforce\\sfdx-diff\\lib\\validations.js:29:19)\nOuter stack:\n at Function.wrap (C:\\Users\\xxxx\\AppData\\Local\\sfdx\\node_modules\\@salesforce\\core\\lib\\sfdxError.js:151:2\sfdxCommand.js:269:67)",7)\n at Diff.catch (C:\\Users\\xxxx\\AppData\\Local\\sfdx\\node_modules\\@salesforce\\command\\lib\\sfdxCommand.js:269:67)"

It doesn't work on the dev org but It works on the UAT or on the production org of the same project...
It works also on the dev org of another project.

VS Code Version: 1.37.1

SFDX CLI Version: 46.11.0

OS and version: Windows 10

bug

Most helpful comment

@Ewaken @lcampos @RandallFlagg I had the same error too. And then execute the [SFDX:Authorize an Org] again, this problem will be resolved.

All 11 comments

Hi @Ewaken, the stack trace you added shows that the command failed because you tried running the diff on a file that is not part of the packageDirectories configured in your project's sfdx-project.json (more info on Salesforce DX Project Configuration). Can you confirm that's the case ?

Hello @lcampos, Thank you for your answer.
That's not the case, here is my sfdx-project.json for all my projects:
{ "packageDirectories": [ { "path": "force-app", "default": true } ], "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", "sourceApiVersion": "46.0" }

And for one project (so I don't change anything on my project, I only log on a different org), the command works for my uat + prod orgs but not on my dev org...

This suddenly happened to us as well. Currently we have 3 computers "affected" with this. It worked fine(if I am not mistaken) until the winter20 update on the ORG. If you install it today as a fresh install it works. If you try to uninstall and then reinstall it still shows the error.

Is there any progress regarding this issue?

@Ewaken @lcampos @RandallFlagg I had the same error too. And then execute the [SFDX:Authorize an Org] again, this problem will be resolved.

@Ewaken @lcampos @RandallFlagg I had the same error too. And then execute the [SFDX:Authorize an Org] again, this problem will be resolved.

Thanks that worked. 😃

@Ewaken @lcampos @RandallFlagg I had the same error too. And then execute the [SFDX:Authorize an Org] again, this problem will be resolved.

Thanks that worked. 😃

Confirmed: after [SFDX:Authorize on Org], diff works again.

@lintaotan @Ewaken @philmui I wonder if the issue was related to the auth tokens expiring or the auth not having a CLI alias associated with it. By any chance could you confirm any of those things ?

In my case, I did an auth org a few min earlier, and it appears that I need
to do org auth twice to get rid of this diff issue. So, it does not appear
to be an auth token expiration issue.

On Fri, Jan 10, 2020 at 1:35 PM lcampos notifications@github.com wrote:

@lintaotan https://github.com/lintaotan @Ewaken
https://github.com/Ewaken @philmui https://github.com/philmui I
wonder if the issue was related to the auth tokens expiring or the auth not
having a CLI alias associated with it. By any chance could you confirm any
of those things ?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/forcedotcom/salesforcedx-vscode/issues/1584?email_source=notifications&email_token=AAATGIIDJQMVR4PXWXZDP5DQ5DS3RA5CNFSM4IO7GYO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIVJAFI#issuecomment-573214741,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAATGIMYPHENM65ZLAKKLWTQ5DS3RANCNFSM4IO7GYOQ
.

@philmui thanks for the info, do you remember if you created an alias for the first auth ? We did a fix for scenarios in which an alias was not created and was causing some failures. I'd like to know if this is going to be addressed by that fix or if this is unrelated to it.

@lcampos In my case there was no alias on my problematic org. I think the token wasn't expired because I could deploy on it, but a new "Authorize an org" solved the problem.

Thanks for confirming @Ewaken, in that case I'll go ahead and close this issue since the fix was part of the updates on version 0.0.5 for @salesforce/sfdx-diff. Thanks for the feedback

Was this page helpful?
0 / 5 - 0 ratings