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

fix: network error tolerance #513

Merged
merged 4 commits into from
Dec 13, 2021
Merged

fix: network error tolerance #513

merged 4 commits into from
Dec 13, 2021

Conversation

mshanemc
Copy link
Contributor

@mshanemc mshanemc commented Dec 9, 2021

What does this PR do?

tolerate ETIMEDOUT and ENOTFOUND on all SDR metadata operations

this is just a low-hanging solution for SDR, not jsforce, so we'll have network errors throwing in auth, org create, packaging, and some other longer-running processes. But hopefully deploy/retrieve operations (push/pull and the deploy/retrieve/delete and mdapi ops) will be a good partial solve.

What issues does this PR fix or reference?

partial solve for @W-5657753@
forcedotcom/cli#1301
forcedotcom/cli#529
forcedotcom/cli#1007

Functionality Before

SDR throws on first connection problem

Error: connect ETIMEDOUT 160.8.252.85:443
    at TCPConnectWrap.afterConnect [as oncomplete*** (node:net:1161:16) ***
  errno: -110,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '160.8.252.85',
  port: 443
***
***
  "status": 1,
  "name": "MetadataTransferError",
  "message": "Metadata API request failed: connect ETIMEDOUT 160.8.252.85:443",
  "exitCode": 1,
  "commandName": "Deploy",
  "stack": "MetadataTransferError: Metadata API request failed: connect ETIMEDOUT 160.8.252.85:443\n    at MetadataApiDeploy.pollStatus (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/source-deploy-retrieve/lib/src/client/metadataTransfer.js:78:27)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async Deploy.deploy (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/plugin-source/lib/commands/force/source/deploy.js:94:37)\n    at async Deploy.run (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/plugin-source/lib/commands/force/source/deploy.js:37:9)\n    at async Deploy._run (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/command/lib/sfdxCommand.js:81:40)\n    at async Config.runCommand (/usr/local/lib/node_modules/sfdx-cli/node_modules/@oclif/config/lib/config.js:173:24)\n    at async SfdxMain.run (/usr/local/lib/node_modules/sfdx-cli/node_modules/@oclif/command/lib/main.js:27:9)\n    at async SfdxMain._run (/usr/local/lib/node_modules/sfdx-cli/node_modules/@oclif/command/lib/command.js:43:20)\n    at async Object.run (/usr/local/lib/node_modules/sfdx-cli/dist/cli.js:162:47)\nDUE TO:\nError: connect ETIMEDOUT 160.8.252.85:443\n    at TCPConnectWrap.afterConnect [as oncomplete*** (node:net:1161:16)\nOuter stack:\n    at Function.wrap (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/core/lib/sfdxError.js:171:27)\n    at Deploy.catch (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/command/lib/sfdxCommand.js:248:67)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async Deploy._run (/usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/command/lib/sfdxCommand.js:85:13)\n    at async Config.runCommand (/usr/local/lib/node_modules/sfdx-cli/node_modules/@oclif/config/lib/config.js:173:24)\n    at async SfdxMain.run (/usr/local/lib/node_modules/sfdx-cli/node_modules/@oclif/command/lib/main.js:27:9)\n    at async SfdxMain._run (/usr/local/lib/node_modules/sfdx-cli/node_modules/@oclif/command/lib/command.js:43:20)\n    at async Object.run (/usr/local/lib/node_modules/sfdx-cli/dist/cli.js:162:47)",

Functionality After

it'll keep trying (within the retry boundaries provided to the poller).
It does emit warnings and debugs about the problem so they're not hidden from the user.

Testing/QA

  • link SDR in plugin-source
  • start a deploy and then turn off your wifi (or pull a cable if you've got one)

@mshanemc mshanemc requested review from a team as code owners December 9, 2021 17:45
@mshanemc mshanemc requested a review from randi274 December 9, 2021 17:45
@WillieRuemmele
Copy link
Member

Will this make commands that encounter a network issue return a 0 exit code?

Timed out deploy/retrieves and push/pulls returning a 0 exit code was a big issue that FinancialForce was seeing in their CI recently. Like #1301 suggests, the default retry could be 0

src/client/metadataTransfer.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@shetzel shetzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

@mshanemc mshanemc requested a review from peternhale December 9, 2021 21:13
@shetzel shetzel merged commit 7042a79 into main Dec 13, 2021
@shetzel shetzel deleted the sm/timeout-resiliency branch December 13, 2021 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants