Salesforcedx-vscode: sfdx diff command failing to find source file in org

Created on 14 Nov 2019  ·  14Comments  ·  Source: forcedotcom/salesforcedx-vscode

Summary

The following commands work fine. I run them consistently to sync source back and forth.

  • sfdx force:source:deploy --sourcepath [_local-filepath_] --json --loglevel fatal
  • sfdx force:source:retrieve --sourcepath [_local-filepath_] --json --loglevel fatal

The new diff command fails with the error below

  • sfdx force:source:diff --sourcepath [_local-filepath_] --json --loglevel fatal

Unexpected error while running ApexProcessor. Error: [_source-filename_] was not found in org when querying with username [_sf-user-name_]

VS Code Version: 1.40.1

SFDX CLI Version: fdx-cli/7.32.0-b30e0302f0 win32-x64 node-v10.15.3

OS and version: Microsoft Windows [Version 10.0.14393]

diff

All 14 comments

Hi @ubjones thanks for opening this issue. The error you are getting means the file you are trying to diff does not exist in the org you are logged into or that you don't have access to it. Can you confirm the file does exist in the org and that you have access to it ?

This issue has been automatically closed because there has been no response to our request for more information from the original author. Currently, there is not enough information provided for us to take action. Please reply and reopen this issue if you need additional assistance.

Hi @lcampos I have been seeing exactly the same issue as described by the original author for every sfdx diff from vscode. For both classes and aura component files. I can successfully deploy and retrieve, but cannot diff. Here's an example log output showing the deploy, retrieve and diff (actual path and username replaced):


Starting SFDX: Deploy Source to Org

19:35:11.359 sfdx force:source:deploy --sourcepath /path/force-app/main/default/aura/PictureChoice/PictureChoice.cmp --json --loglevel fatal
19:35:15.836 sfdx force:source:deploy --sourcepath /path/force-app/main/default/aura/PictureChoice/PictureChoice.cmp --json --loglevel fatal ended with exit code 0

=== Deployed Source
STATE FULL NAME TYPE PROJECT PATH
───── ────────────────────────────────────────────────────────── ──────────────────── ──────────────────────────────────────────────────────────────────────────────────────
Add PictureChoice/PictureChoice.cmp AuraDefinitionBundle force-app/main/default/aura/PictureChoice/PictureChoice.cmp
Add PictureChoice/PictureChoice.cmp AuraDefinitionBundle force-app/main/default/aura/PictureChoice/PictureChoice.cmp-meta.xml
Add PictureChoice/PictureChoice.css AuraDefinitionBundle force-app/main/default/aura/PictureChoice/PictureChoice.css
Add PictureChoice/PictureChoiceController.js AuraDefinitionBundle force-app/main/default/aura/PictureChoice/PictureChoiceController.js
Add PictureChoice/PictureChoiceHelper.js AuraDefinitionBundle force-app/main/default/aura/PictureChoice/PictureChoiceHelper.js

Starting SFDX: Retrieve Source from Org

19:35:52.130 sfdx force:source:retrieve --sourcepath /path/force-app/main/default/aura/PictureChoice/PictureChoice.cmp
=== Retrieved Source
FULL NAME TYPE PROJECT PATH
────────────────────────────────────────────────────────── ──────────────────── ──────────────────────────────────────────────────────────────────────────────────────
PictureChoice/PictureChoice.cmp AuraDefinitionBundle force-app/main/default/aura/PictureChoice/PictureChoice.cmp
PictureChoice/PictureChoice.cmp AuraDefinitionBundle force-app/main/default/aura/PictureChoice/PictureChoice.cmp-meta.xml
PictureChoice/PictureChoice.css AuraDefinitionBundle force-app/main/default/aura/PictureChoice/PictureChoice.css
PictureChoice/PictureChoiceController.js AuraDefinitionBundle force-app/main/default/aura/PictureChoice/PictureChoiceController.js
PictureChoice/PictureChoiceHelper.js AuraDefinitionBundle force-app/main/default/aura/PictureChoice/_PictureChoiceHelper.js
19:35:55.64 sfdx force:source:retrieve --sourcepath /path/force-app/main/default/aura/PictureChoice/PictureChoice.cmp ended with exit code 0

Starting SFDX: Diff File Against Org

19:44:07.705 sfdx force:source:diff --sourcepath /path/force-app/main/default/aura/PictureChoice/PictureChoice.cmp --json --loglevel fatal
19:44:09.560 sfdx force:source:diff --sourcepath /path/force-app/main/default/aura/PictureChoice/PictureChoice.cmp --json --loglevel fatal ended with exit code 1

Unexpected error while running AuraProcessor. Error: PictureChoice.cmp was not found in org when querying with username


VS Code Version:
Version: 1.42.1
Commit: c47d83b293181d9be64f27ff093689e8e7aed054
Date: 2020-02-11T14:44:27.652Z
Electron: 6.1.6
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.3.0

SFDX CLI Version: sfdx-cli/7.48.0-a71f8c6899 darwin-x64 node-v10.15.3

OS and version: macOS 10.15.3 (19D76)

Please re-open this issue.

@mcrooks88 thanks for providing all that info, could you also tell me which version of the sfdx-diff plugin you're using ? You can get that info by running sfdx plugins

@salesforce/sfdx-diff 0.0.6

Also, I have just run sfdx plugins:update but there are no new versions of sfdx-diff available

I experience the same issue, also with @salesforce/sfdx-diff 0.0.6

Salesforce Org: Dev org with managed package (which means it has a namespace prefix)

SFDX installed with home brew (attempted brew cask reinstall sfdx)

VSCode:
Version: 1.49.0
Commit: e790b931385d72cf5669fcefc51cdf65990efa5d
Date: 2020-09-10T17:39:53.251Z
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 19.6.0

OS and version: macOS 10.15.6 (19G2021)

Having same issue. Any status on this?

Also having the same issue. Retrieve from package.xml works fine. Then trying to right click a .cls file > Diff File Against Org fails due to "was not found in org when querying with username".

sfdx-diff version 0.0.6

VSCode:
Version: 1.49.3
Commit: 2af051012b66169dde0c4dfae3f5ef48f787ff69
Date: 2020-10-02T17:54:06.165Z (5 days ago)
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 19.6.0

Hi @lcampos

I am having the same issue with a dev org (API 50), which is being used to develop a managed package, which has a namespace set.

Version: 1.50.0 (user setup)
Commit: 93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3
Date: 2020-10-07T06:10:52.432Z
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.19041

I am getting the same error too when i try to pull down the duplicate rules from an org.

Version: 1.51.1 (user setup)
Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f
Date: 2020-11-10T23:34:32.027Z
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 6.1.7601

Nov. 27, 2020. I'm still getting this error with sfdx diff in VSCode while having no problems with deploy and retrieve.
sfx diff is using the alias name instead of using the value associated with the alias, and so gives the error:

sfdx force:source:diff --sourcepath _srcfilename_ --json --loglevel fatal
Unexpected error while running XXX. Error: _base srcfilename_ was not found in org when querying with username _ALIAS_NAME_BEING_USED_HERE_

I've tried all the tips listed here, including:

  • clear up aliases
  • remove tools/, typings/ folders and restarting VSCode
  • etc

sfdx version info:

sfdx-cli/7.81.0-7b953c80d1 darwin-x64 node-v12.18.3
@salesforce/sfdx-diff 0.0.6
salesforcedx 50.6.0 (core)
├─ schema 1.0.1 (core)
├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
├─ templates 50.1.0 (core)
├─ custom-metadata 1.0.10 (core)
├─ apex 0.1.4 (core)
└─ salesforce-alm 50.6.0

Hi, any updates/ideas on this one? I am facing a similar issue.
I am new and do not know much.

I would like to work on this if someone can guide me with initial pointers.

Thanks.

Hi @abhishekmadhu - We have some improvements underway to Diff against an org. In the meantime, you can see the current documentation here: https://developer.salesforce.com/tools/vscode/en/user-guide/source-diff

Was this page helpful?
0 / 5 - 0 ratings