Issue with pushing source code to Scratch Org

salesforcedx-cliscratch-org

I've recently ran into some issues with pushing my source code into newly created scratch orgs. I've created 3 of them prior to this, so I'm pretty sure the process is correct. I've tried using the newest version of the salesforce-cli, as well as an older version (7.142.0), but none of them are workingenter image description here

This is the error I'm getting, but I'm able to push up code to already existing scratch orgs. The process in which I've been going is the following steps

  1. sfdx force:org:create -f config/project-scratch-def.json -a YOURSCRATCHORGNAME -d 30
  2. sfdx force:package:install -p 04tU0000000UhK3 -u YOURSCRATCHORGNAME
  3. sfdx force:user:password:generate –targetusername YOURSCRATCHORGNAME
  4. sfdx force:source:push -f -u YOURSCRATCHORGNAME (This is where I'm running into the issue)

Best Answer

ECONNRESET happens to me from time to time.

There are some tweaks you can use but there is no guarantee that you won't see that again.

  1. Unfortunately during the preview window, it started to happen more often. After some research, I found this - https://github.com/forcedotcom/cli/issues/1690

What helped was to use a preview Scratch Orgs.

Either update your definition file or within a command put release=preview

Example:

sfdx force:org:create -f config/project-scratch-def.json -a YOURSCRATCHORGNAME -d 30 release=preview

People reported that it is case sensitive so be sure you use lowercase, regardless in official documentation it is Preview

  1. Add some env variables like the following:
  • SFDX_DNS_TIMEOUT = 120
  • SFDX_DOMAIN_RETRY = 320
  • SFDX_REST_DEPLOY = true

Reference: https://developer.salesforce.com/docs/atlas.en-us.232.0.sfdx_setup.meta/sfdx_setup/sfdx_dev_cli_env_variables.htm

  1. If you have an automated process, create custom logic to log stdout and stderr from the command. If ECONNRESET happens - retry the job, or if it was in progress, check for
sfdx force:source:deploy:report

if that succeeded or not.

Related Topic