vscode-sftp icon indicating copy to clipboard operation
vscode-sftp copied to clipboard

[error] Error: Config Not Found. (file: <filename>) lists the file being sent not the config file

Open cliff-in-auld-reekie opened this issue 1 year ago • 4 comments

Do you read the FAQ?

  • [ ] Yes. And I looked thru' issues for any duplicate.

Describe the bug When I try to upload I get an error and that's fine as I'm setting up new targets. However, the stated filename is not the config file SFTP can't find but the file I'm trying to upload. That's a tad useless as I know what I'm trying to upload but I don't know which config file(s) it is looking for or where exactly it is looking.

To Reproduce Right click, Upload file

Expected behaviour The error message stating the name and location of the config file(s) it is not finding.

Screenshots Wouldn't really help

Desktop (please complete the following information):

  • OS: MacOS Sequoia 15.1
  • VSCode Version Version: 1.95.1
  • Extension Version v1.16.3

Extension Logs from Startup - required [11-07 12:14:10] [trace] run command 'Upload File' [11-07 12:14:10] [error] Error: Config Not Found. (file:///Users/cliffwallace/Desktop/_VSCode/rpi/MagicMirror/docs/install.text) at Object.l (/Users/cliffwallace/.vscode/extensions/natizyskunk.sftp-1.16.3/dist/extension.js:2:296202) at t.default. (/Users/cliffwallace/.vscode/extensions/natizyskunk.sftp-1.16.3/dist/extension.js:2:221424) at Generator.next (:null:null) at /Users/cliffwallace/.vscode/extensions/natizyskunk.sftp-1.16.3/dist/extension.js:2:220593 at new Promise (:null:null) at n (/Users/cliffwallace/.vscode/extensions/natizyskunk.sftp-1.16.3/dist/extension.js:2:220338) at /Users/cliffwallace/.vscode/extensions/natizyskunk.sftp-1.16.3/dist/extension.js:2:221365 at Array.map (:null:null) at t.default. (/Users/cliffwallace/.vscode/extensions/natizyskunk.sftp-1.16.3/dist/extension.js:2:221357) at Generator.next (:null:null) at s (/Users/cliffwallace/.vscode/extensions/natizyskunk.sftp-1.16.3/dist/extension.js:2:220395)

cliff-in-auld-reekie avatar Nov 07 '24 12:11 cliff-in-auld-reekie

Possibly related, albeit on a Windows machine: I receive this exact error when I try to deploy using a network share, SMB or otherwise. As a control, I temporarily moved my entire vs code project onto my local disk to re-attempt deployment with the exact same config; it worked fine.

My consistent workaround while continuing to use network shares is to deploy manually via right-clicking my solution's root folder: Sync Local -> Remote. For some reason, that works fine even on a remote share.

I was looking around these forums for a network share related issues but couldn't find one. If your issue turns out to be unrelated, sorry to waste your time and I'll open a separate issue later.

Here's my config for reference. I use a UN:PW auth method since I couldn't get password-based PKI to work with this tool for the life of me:

{
	"name": "some_site",
	"host": "192.168.0.30",
	"context": "W:/Source/Sites",
	"protocol": "sftp",
	"username": "deployment",
	"password": "super_secret",
	"remotePath": "/var/www",
	"syncOption": {
		"update": true,
		"delete": true
	},
	"uploadOnSave": false
}

uploadOnSave: false disables the broken auto-save logic syncOption: {} helps keep the destination dir clean as I rename my deployment files trillions of times

ghost avatar Nov 09 '24 18:11 ghost

@cliff-in-auld-reekie and @MHagood

I've encountered an unusual situation:

  • When opening the folder using Project Manager or similar tools, the upload on save action fails with a configuration not found error.
  • However, when opening the folder directly using VS Code's built-in "Open Folder" option, the upload on save works correctly.

Try it out and let me know if it also works for you.

gsabater avatar Nov 27 '24 15:11 gsabater

I've encountered an unusual situation:

I can confirm this.

What works for me is to directly open the specific folder that contains the file(s) you want to upload as well as the .vscode folder with the valid sftp.json configuration file.

Also, I have noticed that when you open a folder higher up in the folder tree (whether directly or using some other method, such as a favorites extension), the sftp extension initially finds the configuration file (1), but then when you try to upload a file, it suddenly can't find the configuration file any more (2).

image

RayCulp avatar Dec 19 '24 01:12 RayCulp

@cliff-in-auld-reekie and @MHagood

I've encountered an unusual situation:

  • When opening the folder using Project Manager or similar tools, the upload on save action fails with a configuration not found error.
  • However, when opening the folder directly using VS Code's built-in "Open Folder" option, the upload on save works correctly.

Try it out and let me know if it also works for you.

This comment pointed me in the right direction. Like you said, when opening a project via "Project Manager" the SFTP extension can't find the config file, however when opening the project via File - Open Folder, then it works correctly. This makes it sound as if the "Project Manager" sets some kind of $HOME variable for the projects root folder, which the SFTP extension either can't read or misreads. (relative vs. absolute vs symlinks?)

I realized that I have all my project folders either inside iCloud, ProtonDrive or Dropbox. Since the full path to those folders are insanely long, I created symlinks to each of those folders. (I'm using macOS).

In my VSCode Project Manager config file I'm using the relative path of the symlink and so far it worked without any issues. except with the SFTP extension.

When I change the rootPath in the Project Manager from the relative path of the symlink and replace it with the absolute path, it works. I can now open the project via Project Manager and the SFTP extension works.

Project Manager config file with relative path using a symlink: SFTP extension won't find its own config file.

{
	"name": "My Project",
	"rootPath": "~/work/my-project", // relative path using a symlink
	"paths": [],
	"group": "",
	"enabled": true
}

Project Manager config file with true absolute path, no symlink: SFTP extension works as intended.

{
	"name": "My Project",
	"rootPath": "/Users/username/Library/CloudStorage/[email protected]/work/my-project",
	"paths": [],
	"group": "",
	"enabled": true
}

I'm still not sure if this is only related to just relative paths, or symlinks with relative paths, or symlinks which point to folders which are synced via cloud providers like iCloud, Dropbox or ProtonDrive.

Anyway, using the absolute path for a project in the Project Manager config file works.

aedanobrien avatar Dec 20 '24 04:12 aedanobrien