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.

Cannot read property 'fspath' of undefined --> when using a Keyboard shortcut to deploy Salesforce file

See original GitHub issue

I added a custom keyboard shortcut to deploy current file using “sfdx.force.source.deploy.current.file” command

One of our business requirements is to figure out a keyboard shortcut that can do Save and compile of Apex classes from VSCode while doing ORG based development. This is very important for us to roll out VSCode and drive adoption of its use for Salesforce development. This feature is currently not available in VSCode and hence I tried adding a keyboard shortcut for the sfdx command but I am running into an issue.

Steps To Reproduce:

  1. Go to Code --> Preferences --> Keyboard Shortcuts
screen shot 2018-10-05 at 9 17 56 am
  1. Open keybindings.json file
screen shot 2018-10-05 at 9 19 37 am
  1. Add the below command in your keybindings.json file

[ { "key": "shift+cmd+r", "command": "sfdx.force.source.deploy.current.file" } ]

  1. This is how your keybindings.json file should look like
screen shot 2018-10-05 at 9 20 54 am
  1. Now open an Apex class or Visualforce page or Trigger file and press Shift+Cmd+r

Expected result

The file should have been deployed

Actual result

screen shot 2018-10-05 at 9 23 21 am

VS Code Version:

screen shot 2018-10-05 at 9 24 51 am

SFDX CLI Version:

screen shot 2018-10-05 at 9 25 39 am

OS and version:

screen shot 2018-10-05 at 9 26 12 am

Other Commands just work perfectly fine, for e.g.

[ { "key": "shift+cmd+r", "command": "sfdx.force.org.open" } ]

screen shot 2018-10-05 at 9 40 37 am

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:58 (18 by maintainers)

github_iconTop GitHub Comments

8reactions
xixiaofinlandcommented, Oct 29, 2018

One of my colleagues found a good way to do this:

Output: hit “cmd+shift+b” (in MacOS), it will do

  1. save 2)sfdx deploy current file

Steps

  1. Go to “Terminal” in VSC top menu
  2. Click “Configure tasks…”
  3. New a task from a template
  4. Copy paste code below to “tasks.json” and save
  5. Now “cmd+shift+b” (the default build hotkey) will do what we want.
{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
	"tasks": [
	{
	"label": "ssave",
	"type": "shell",
	"command": "sfdx force:source:deploy -p ${file}",
	"group": {
	"kind": "build",
	"isDefault": true
	},
	"problemMatcher": []
	}
  ]
}
6reactions
ntottencommented, Jan 10, 2019

Save on deploy is going out in our next release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SFDX ERROR: Cannot read property 'fileName' of undefined.
I am getting an error when trying to do a sfdx retrieve: ERROR: Cannot read property 'fileName' of undefined. Here is the command...
Read more >
Error deploying to org: "Cannot read property 'success' of ...
Just had the same error and I found the root cause: when Apex class .cls and .cls-meta.xml file names do not match, CLI...
Read more >
Cannot read property 'fsPath' of undefined - Get Help
Hi! :slight_smile: I'm trying to deploy my company's site and I'm getting this error: TypeError: Cannot read property 'fsPath' of undefined ...
Read more >
Zayne Turner в Twitter: „@ForceGraells @SalesforceDevs Yes! It's ...
know how to attach a keyboard shortcut in VSCode to "SFDX:Deploy Source to Org", ... Cannot read property 'fspath' of undefined --> when...
Read more >
VS Code keyboard shortcut to SFDX: Deploy This Source to ...
... Deploy This Source to Org" in Visual Studio Code, the command fails with the error message "Cannot read property 'fsPath' of undefined" ......
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