When I trying to push into my Scratch Org from CLI, using the command sfdx force:source:push -u TestScratchOrg -f then I'm encountering the error

Unhandled rejection TypeError: Cannot read property 'result' of null
    at C:\Users\703224811\AppData\Local\sfdx\client\7.57.1-dbf54fc584\node_modules\jsforce\lib\api\metadata.js:53:16
    at tryCallOne (C:\Users\703224811\AppData\Local\sfdx\client\7.57.1-dbf54fc584\node_modules\promise\lib\core.js:37:12)
    at C:\Users\703224811\AppData\Local\sfdx\client\7.57.1-dbf54fc584\node_modules\promise\lib\core.js:123:15
    at flush (C:\Users\703224811\AppData\Local\sfdx\client\7.57.1-dbf54fc584\node_modules\asap\raw.js:50:29)
    at process._tickCallback (internal/process/next_tick.js:61:11)

I'm using the VSCode for this purpose and I'm using the CLI version 7.57.1-dbf54fc584 Which I guess the most recent version.

  • I guess you are trying to push some NodeJS related code as well? Looks like it could be related some compilation error with the source code. – arut May 8 '20 at 5:46
  • Maybe you don't have node.js installed on your computer, try again after installing it. Salesforce cli requires node. – Raul May 8 '20 at 7:36
  • @Raul node.js is already installed in my system and currently, I'm running on v12.13.0 version of node.js – Abhishek Gangwar May 8 '20 at 8:26
  • Could you then try updating npm and sfdx then try again? – Raul May 8 '20 at 9:03

I'm having the same issue. It has been intermittent but is now very consistent. I have the latest node and sfdx updates installed. Help?!

  • Try to run command "sfdx update" and then use push command. – Abhishek Gangwar Dec 18 '20 at 13:19
  • Thanks @AbhishekGangwar but I have updated both sfdx-cli and salesforcedx via npm to [at]latest and had no luck. I have tried uninstalling and reinstalling via both the windows installer as well as using npm. I did find a hacky solution which I'll post on the main thread. – Dunks184 Jan 19 at 23:50

I have found a somewhat hacky solution for this problem. The problem exists at ...AppData\Local\sfdx\client\7.57.1-dbf54fc584\node_modules\jsforce\lib\api\metadata.js:53:16 (in my file, it's actually at line 54 but I'm also on version 7.85.0 rather than 7.57.1).

The line there is return res.result; The author has not checked for a null result.

If you change this line to return res !== null ? res.result : {}; the code will not fail.

Now, I'm uncertain of why res is coming back as null and I haven't found any problems so far since I altered it but use at your own risk. I'm not sure if this was just an oversight or if res being null indicates a component was not pushed correctly. Again, I have not found any problems with pushing since I changed this and there are no components that are missing or anything - but I haven't dug through the code enough to find out why res is null and what that means.

Hope this helps someone out there. It drove me nuts for months!

Thanks, Duncan

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.