Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Org Browser fails to retrieve source from Org #5143

Closed
egym-nikokokkila opened this issue Oct 10, 2023 · 48 comments
Closed

Org Browser fails to retrieve source from Org #5143

egym-nikokokkila opened this issue Oct 10, 2023 · 48 comments

Comments

@egym-nikokokkila
Copy link

egym-nikokokkila commented Oct 10, 2023

Summary

If I select Org Browser in VScode and try to 'Retrieve Source from Org' I receive an error ENOENT: no such file or directory, stat 'c:\.eslintignore'

Steps To Reproduce:

  1. Select Org Browser in VScode
  2. For example select 'Custom Objects'
  3. Click 'Retrieve Source from Org' cloud icon for Accounts

Expected result

Component metadata for Accounts should be retrieved.

Actual result

No metadata is retrieved and got error ENOENT: no such file or directory, stat 'c:.eslintignore'

Additional information

image
image

When updating SF CLI this error msg is received. Not sure if this could be related?
`PS C:\Users\UserName\Desktop\GHEGYM\salesforce> sf update
@salesforce/cli: Updating CLI... already on version 2.11.8-c9872b8
NOTE: This error can be ignored in CI and may be silenced in the future

  • Set the SF_HIDE_RELEASE_NOTES env var to "true" to skip this script

Error: spawn C:\Users\UserName\AppData\Local\sf\client\2.11.8-c9872b8\bin\run.cmd ENOENT`

I have tried new clean install for VScode with all the extensions, Salesforce CLI, Node.js with also removing associated Environment Variables. After running uninstall also removed all hidden folders for VScode and SalesforceCLI

Also tried to install older version of Salesforce CLI and the VScode extensions. Additionally tried to disable ESLint extension or downgrade to older version. Nothing has helped so far.

The issue is impacting everyone in our five member SF team. Reported first time on 29.9.23

Salesforce Extension Version in VS Code: v58.16.0

SFDX CLI Version: 2.11.8 win32-x64 node-v18.15.0

OS and version: Windows 11 Pro, 22H2

VS Code version:
Version: 1.83.0 (user setup)
Commit: e7e037083ff4455cf320e344325dacb480062c3c
Date: 2023-10-03T16:12:16.321Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22621

@peternhale
Copy link
Contributor

@egym-nikokokkila this issue seems similar to forcedotcom/cli#2447, however you have already installed the latest version of sf, using the windows installer, which is one of the work arounds mention in the linked issue. I am checking with the team that owns the sf command to see what steps are next.

An alternative work around mentioned is installing sf via npm. This would require removing remnants of the cli install before installing using npm install @salesforce/cli -g.

@egym-nikokokkila
Copy link
Author

@peternhale Thanks for advice.
I tried the work around you suggested.

  • Uninstalled SalesforceCLI
  • Deleted .sf and .sfdx folders manually from user's home folder
  • Removed Environment Variable C:\Program Files\sf\bin
  • Also removed VScode extensions

Then installed SalesforceCLI using the command npm install @salesforce/cli -g

Intalled 'Salesforce Extension Pack (Expanded)' again in VScode.

Had error
sf : File C:\Users\UserName\AppData\Roaming\npm\sf.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

I was able to get over this by running Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser in PowerShell

After that tried using Org Browser again. But the same error still occurs ENOENT: no such file or directory, stat 'c:\.eslintignore'

In VSCode File Explorer I can use method of right click (for example folder objects\Opportunity\fields) and select 'SFDX: Retrieve Source' from Org

It works fine but unfortunately it does not retrieve any new files I need.

@peternhale
Copy link
Contributor

@egym-nikokokkila thank you. I was wondering if you would try one more thing for me. Please uninstall the Salesforce Extension Pack (Expanded) and then install (if not already installed) Salesforce Extension Pack. The reason I ask is the expanded extension pack includes additional extensions and I would like to remove those from the equation to help diagnose the cause.

@egym-nikokokkila
Copy link
Author

@peternhale I uninstalled the Salesforce Extension Pack (Expanded) and then installed Salesforce Extension Pack
The same error ENOENT: no such file or directory, stat 'c:.eslintignore' still occurs.

I see for the Salesforce Extension Pack the ESLint is not listed but it was installed anyway.

I'm only using the official Salesforce Extension Pack and no other VScode extensions installed.

@peternhale
Copy link
Contributor

@egym-nikokokkila could you disable or uninstall the eslint extension and try again?

@egym-nikokokkila
Copy link
Author

@peternhale I was able to delete Eslint extension but it had dependency to Lightning Web Components extension so it had to be removed too.

But this still results receiving the same ENOENT: no such file or directory, stat 'c:\.eslintignore' error.

Earlier I was able to disable Eslint but it did not have any effect.

@peternhale
Copy link
Contributor

peternhale commented Oct 10, 2023

@egym-nikokokkila this is a hack, but you could try creating the c:\.eslintignore and see if that gets you further along. Just diagnostic for now.

@egym-nikokokkila
Copy link
Author

@peternhale Added file .eslintignore to root of c:
Then the error is ENOENT: no such file or directory, stat 'c:\.eslintrc.json'
After adding that file
ENOENT: no such file or directory, stat 'c:\.forceignore'
After that
ENOENT: no such file or directory, stat 'c:\.git'

@SvenSoederberg
Copy link

SvenSoederberg commented Oct 10, 2023 via email

@peternhale
Copy link
Contributor

@SvenSoederberg yes, leaning in that direction.

@egym-nikokokkila How did you create the dx project where these errors are occurring?

@egym-nikokokkila
Copy link
Author

egym-nikokokkila commented Oct 10, 2023

@peternhale It was created by using command git clone <GitHub URL of repository>

To solve the issue one thing I also tested was to clone new local repository.

@peternhale
Copy link
Contributor

@egym-nikokokkila is the repo public?

@egym-nikokokkila
Copy link
Author

@peternhale It is private

@peternhale
Copy link
Contributor

@peternhale It was created by using command git clone <GitHub URL of repository>

To solve the issue one thing I also tested was to clone new local repository.

@egym-nikokokkila So I am clear, the retrieve worked for a new local clone? Same remote previously used or different?

@egym-nikokokkila
Copy link
Author

@peternhale Sorry for confusion. No, the issue is still present even when trying to clone a new local repository.

The remote repository I tried cloning is the same we have been using all the time.

@peternhale
Copy link
Contributor

@egym-nikokokkila can your check workspace and user settings to see which you might have set? You can find the keys in the Settings Options on the extension's info page.

@egym-nikokokkila
Copy link
Author

@peternhale For all the extensions we are using they are enabled globally and also 'Apply Extension to All Profiles' is set true.

For the ESLint I disabled it globally with the other extension Lightning Web Components but it did not have any effect if the error is received or not.

@SvenSoederberg
Copy link

@peternhale This problem started for all our users all of a sudden at the same day.

The strange thing is that after checking out some "old" branches, the issue does not exist for those old branches - only for new ones.

Interestingly, if you compare those new and old branches, there is no "relevant" difference: Only metadata changes and some changes in our CI/CD scripts / github workflows

@peternhale
Copy link
Contributor

@SvenSoederberg both interesting and scary. Do you happen to have the exact date, so I might compare it to changes made on our side during the same period?

@SvenSoederberg
Copy link

@peternhale I am pretty sure it started on Oct, 1st.

I also asked our IT guys, if they changed some settings / distributed some changes but no - they did not

@peternhale
Copy link
Contributor

Thank you @SvenSoederberg. Let me see what I can find that may be related.

@SvenSoederberg
Copy link

@peternhale by the way: We did not approve any dependabot PRs as I was a bit concerned about unforseeable impacts these changes could have...

As an overview, I add a screenshot of out uat2 branch. As you can see, none of the "config" files was changed recently.
.vscode contains extensions.json, launch.json and settings.json (all quite standard, I would say.) The config folder only contains pmd rules (unchanged since a long time and irrelevant for any sfdx stuff)

image

If needed, @egym-nikokokkila (I am off for two weeks starting after tomorrow) could provide you with the package.json, package-lock.json or any file you need (but both package.json, package-lock.json are not gitignored - and were not changed recently)

Thanks a lot for your support and investigation!

@SvenSoederberg
Copy link

@peternhale Please don't feel spammed, but I try to provide as much information that might help you - these will be my last comments before my holiday. I promise ;-)

  1. one of our users is using a mac and is also getting the same error message "ENOENT: no such file or directory, stat '**c:.**eslintignore'". This may be an incredibly stupid comment (I never uses a mac..) but I had the feeling, c:... is a windows path
  2. regarding my previous screenshot: We checked if something was deleted (that would not show up in the screenshot) but this is not the case
  3. I did NOT install sf (v2) - still on sfdx (v7). If I got it correctly, @egym-nikokokkila installed sf - but both of us and other users get the same error messages
  4. If I run sfdx force:source:retrieve -p bla/blub... using a relative path for a file I have on my machine already, the command works
  5. If I try to use the Org Browser (I am not a big fan of doing so) ,for the same file, it fails. I believe it is the same for users that installed sf (v2)
  6. In my opinion even worse, sfdx force:source:pull does not work any more (at least for me). Same when adding -f
  7. I did not try sfdx force:source:push

@peternhale
Copy link
Contributor

@SvenSoederberg with issues like this, the more clues the better. I appreciate you for the effort you and your co-workers are putting into this to help us get to the bottom of this problem.

  1. A path on Mac certainly does not contain a C:. This is a great clue! It means that somewhere there is a hardcoded windows path.
  2. Thank you added detail
  3. I would recommend upgrading to sf (v2), but not until after your holiday. We are now three months since the last version of sfdx (v7) was published
  4. @egym-nikokokkila have you tried running the command this way using sf?
  5. Thanks for the additional clue
  6. @egym-nikokokkila could you also try this with sf

Sven, thanks again for all these details. I hope you have a wonderful holiday.

@peternhale
Copy link
Contributor

@egym-nikokokkila I was wondering if you are able to share the extension host logs with me, or at least scan them to see if the error is present in any of them? This might help me narrow which extension to focus on.

Command palette -> Developer: Open Extension Logs Folder will show where these files are located.

@egym-nikokokkila
Copy link
Author

@peternhale @SvenSoederberg I confirm yes I have been using the sf (v2)

I can execute the sf force:source:retrieve command but I do not get the file changes in VScode (I did some editing for the field to test this)
image

sf force:source:pull For me it does not work.
image

Same command with -f and we see the error ENOENT: no such file or directory, stat 'C:\.eslintignore'
image

sfdx force:source:push
image

I will send the extension logs later today.

@egym-nikokokkila
Copy link
Author

@peternhale From the folder C:\Users\UserName\AppData\Roaming\Code\logs\20231017T163458\window1\exthost\output_logging_20231017T163459

I can find file 2-Salesforce CLI.log and this is the content for the file

16:38:40.847 Starting SFDX: Retrieve Source from Org

ENOENT: no such file or directory, stat 'c:\.eslintignore'

I searched through all files in this folder and subfolders using term c:\.eslintignore C:\Users\UserName\AppData\Roaming\Code\logs\20231017T163458\window1\exthost

And seems 2-Salesforce CLI.log is the only one I could find.

@git2gus
Copy link

git2gus bot commented Oct 18, 2023

This issue has been linked to a new work item: W-14319389

@gbockus-sf
Copy link
Contributor

Found a few issues in the CLI repo with the same error:
forcedotcom/cli#1292
forcedotcom/cli#1416
forcedotcom/cli#2150

I'm going to throw together a debug vsix so we can get some error logging to see if we can't track down the source of this issue.

@gbockus-sf
Copy link
Contributor

@egym-nikokokkila @SvenSoederberg I created a VSIX and instructions for log collection in a release on my fork https://github.com/gbockus-sf/salesforcedx-vscode/releases/tag/v0.2.0

I highly suspect this is going to be an issue in one of the shared libraries between the CLI and VSCE due to both environments being impacted by the same issue. Mostly just a warning that this debugging will help narrow the issue, but will probably need a followup to get more logging from where the issue is occurring.
Thanks for your help tracking down this 🐛 !

@egym-nikokokkila
Copy link
Author

@gbockus-sf I followed the instructions and got to step 8.
image

With right click on console area I do not get a menu to select Save As

It should work just like in this video, right?
https://duckly.com/watch/5dc59913d1eee54f8bbffb87

I checked all the settings but did not find anything that could help.

@gbockus-sf
Copy link
Contributor

Thanks @egym-nikokokkila
Yup that's how I save the logs but maybe it's an os specific limitation. I'll analyze the log later tonight for next steps.

@gbockus-sf
Copy link
Contributor

@egym-nikokokkila If you could also remove the filter and send the area of the console where the error is listed that'd be awesome. Thanks!

@egym-nikokokkila
Copy link
Author

@gbockus-sf Menu appears when clicking outside the window. I saved the files and sent them for you.

@gbockus-sf
Copy link
Contributor

@egym-nikokokkila Thanks agains for the logs. I was able to trace the issue down to this call into the source-deploy-retrieve lib

    const localSourceComponents = ComponentSet.fromSource({
      fsPaths: packageDirs,
      include: toRetrieve
    });

I added some additional logging to that bundled module and uploaded a new debug vsix here

If you could repeat the process and sent the logs I think we'll be close. There will be some paths in the debug output so feel free to email [email protected] if you'd like to avoid uploading them here.

My current suspicion

  1. Theres a stat of the directory attempting to find the file for retrieval. There was some updated code in that flow to use lstat instead of stat to follow sym links. Do you happen to have a sym link in your project path?

Thanks!

@egym-nikokokkila
Copy link
Author

@gbockus-sf I sent the most recent log files.

This might be something @SvenSoederberg can answer:
Theres a stat of the directory attempting to find the file for retrieval. There was some updated code in that flow to use lstat instead of stat to follow sym links. Do you happen to have a sym link in your project path?

@peternhale peternhale removed their assignment Oct 23, 2023
@gbockus-sf
Copy link
Contributor

Exchanged emails with @egym-nikokokkila. We continue to exchange logs and are narrowing in on the cause. It appears that the SDR library is having issues walking the project structure looking for the correct component to retrieve. Just posting here for tracking purposes.

@gbockus-sf gbockus-sf self-assigned this Oct 23, 2023
@michaeljenn2010
Copy link

@gbockus-sf - Hello team, I'm having the same issue as above and have also tried all the steps above with no luck. Is there a work around for this issue? Thanks for your help!

$ sfdx --version
@salesforce/cli/2.15.9 win32-x64 node-v18.18.2

@gbockus-sf
Copy link
Contributor

@michaeljenn2010 I've dug through the provided logs and haven't been able to track down a root cause. My current suspicion is that it has to do with a sym link in the project path, but that is unverified. I'm going to attempt to meet with Niko to debug interactively.

If you wanted to attempt debugging it would be interesting to create a project that root of the file system and see if the issue still occurs.

@vromanov-sumup
Copy link

Our windows users started to report the issue since Tuesday Dec 12th.
when trying to retrieve metadata in Org Browser in VScode : ENOENT: no such file or directory, stat 'c:\.dockerignore'

tested on
salesforce extension pack v 59.8.0
sf --version: @salesforce-bot/cli/2.21.7 win32-x64 node-v20.10.0

when running retrieve with command line the sfdx command gives the same error
sfdx force:source:retrieve -m Flow:MyFlow

this new sf command works!
sf project retrieve start -c -m Flow:MyFlow

@gbockus-sf
Copy link
Contributor

@vromanov-sumup
interesting. Can you try the sf command without the -c and see if it fails in the same way? The -c flag indicates it should ignore conflicts which changes the flow for how the retrieve is done.
sf project retrieve start -m Flow:MyFlow

Are your windows users all working on the same org/project?

There are two current suspect conditions

  1. There some metadata that is getting incorrectly parsed as we walk the dir structure to find metadata. (Email is suspect)
  2. There's a sym link in the path the isn't getting handled correctly.

Are there any sym links used in the project path?

@vromanov-sumup
Copy link

@gbockus-sf
The error appears without -c
same project,
No sym links, unless user's folder in windows itself, path looks like this c:\Users\User Name\workspace\project

Also, this command works
sfdx force:source:retrieve -p force-app/main/default/flows/MyFlow.flow-meta.xml

@egym-nikokokkila
Copy link
Author

@gbockus-sf Interestingly when I added following to .forceignore file

#Added to .forceignore
**/EmailMessage

The Org Browser works then totally fine for retrieving any metadata. (Only exception being the EmailMessage)

After removing this there is again the error ENOENT: no such file or directory, stat 'c:\.eslintignore'

@gbockus-sf
Copy link
Contributor

@egym-nikokokkila Nice. Thanks for swinging back to let use know. I'll follow up with you on email to see if we can identify what Email metadata is causing this issue.

@vromanov-sumup Could you try adding the above entry to the .forceignore file and see if you're issue is also around the EmailMessage type?

@vromanov-sumup
Copy link

We went today through the recent commits and found out that in our case it was creating a custom folder in force-app/main/default >< we wanted to separate platform event definitions from custom objects in a folder force-app/main/default/platformEvents,
moving the definitions to force-app/platformEvents/objects solved the issue
makes sense to error, but the message was really misleading.
thanks for listing the "suspect conditions" @gbockus-sf :)

@gbockus-sf
Copy link
Contributor

I'm gong to close this issue as at least understood although we never did get to the root of the ENOENT: no such file or directory, stat error. Please reopen if you want to continue digging. For anyone that encounters this issue it comes down to getting something out of sorts when walking the filesystem. Good things to check are Emails (see above messages).

@av4213
Copy link

av4213 commented Dec 5, 2024

@egym-nikokokkila @gbockus-sf I am having the same issue.. @egym-nikokokkila how did you idenity that Email Message is the cause for this in the branch?

@gbockus-sf
Copy link
Contributor

@av4213 It's been a while but from what I recall we found it when debugging by checking what metadata type was being processed. It required the debug vsix to generate very noisy detailed logs. It was basically a guess to add the EmailMessage to the ignore file since it was the last thing being processed before the error occurred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants