question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SFDX: diff file against org

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
lintaotancommented, Dec 2, 2019

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

2reactions
Ewakencommented, Aug 28, 2019

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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source Diff | Salesforce for VSCode
The Source Diff command allows you to diff metadata types against your default org. This feature makes it easier to visualize the changes...
Read more >
Simple way to diff a file in local SFDX project against ...
Show activity on this post. From the terminal, run sfdx plugins:install @salesforce/sfdx-diff. After the installation is complete, @salesforce/ ...
Read more >
SFDX : Diff File Against Org - Never stop running #4117 - GitHub
I'm trying to compara my apex class in local with the one on the Saelsforce org. When I use the functionnality "SFDX :...
Read more >
salesforce/sfdx-diff NPM
Salesforce CLI (oclif) plugin for diffing source. Enables you to diff your local source file against its version in an org. ... $...
Read more >
Salesforce Diff - Visual Studio Marketplace
Salesforce Diff. This extension allows you to diff metadata against a Salesforce org. NOTE: Still in very early stages!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found