cli
cli copied to clipboard
sfdx force:source:deploy:report is throwing The org cannot be found
Summary
sfdx force:source:deploy:report sometimes fail with this error: ERROR running force:source:deploy:report: Metadata API request failed: The org cannot be found
This started to happen after we upgrade to version 7.165 from version 7.140
Steps To Reproduce:
run sfdx force:source:deploy:report
System Information
- Which shell/terminal are you using? bash
› Warning: sfdx-cli update available from 7.165.0 to 7.166.1. { "cliVersion": "sfdx-cli/7.165.0", "architecture": "linux-x64", "nodeVersion": "node-v16.17.0", "pluginVersions": [ "@jayree/sfdx-plugin-manifest 2.2.10 (user)", "@jayree/sfdx-plugin-prettier 1.1.7 (user)", "@oclif/plugin-autocomplete 1.3.0 (core)", "@oclif/plugin-commands 2.2.0 (core)", "@oclif/plugin-help 5.1.12 (core)", "@oclif/plugin-not-found 2.3.1 (core)", "@oclif/plugin-plugins 2.1.0 (core)", "@oclif/plugin-update 3.0.0 (core)", "@oclif/plugin-version 1.1.2 (core)", "@oclif/plugin-warn-if-update-available 2.0.4 (core)", "@oclif/plugin-which 2.1.0 (core)", "alias 2.1.0 (core)", "apex 1.2.0 (core)", "auth 2.2.3 (core)", "community 2.0.0 (core)", "config 1.4.17 (core)", "custom-metadata 2.0.0 (core)", "data 2.1.2 (core)", "generator 2.0.2 (core)", "info 2.0.1 (core)", "limits 2.0.1 (core)", "org 2.2.0 (core)", "schema 2.1.1 (core)", "signups 1.2.0 (core)", "source 2.0.12 (core)", "telemetry 2.0.0 (core)", "templates 55.1.0 (core)", "trust 2.0.3 (core)", "user 2.1.0 (core)", "@salesforce/sfdx-plugin-lwc-test 1.0.0 (core)", "salesforce-alm 54.8.1 (core)", "sfdx-git-delta 5.0.7 (user)", "sfdx-jayree 4.3.4 (user)", "sfpowerkit 5.0.0 (user)" ], "osVersion": "Linux 5.10.60.1-microsoft-standard-WSL2", "shell": "bash", "rootPath": "/usr/local/lib/node_modules/sfdx-cli" }
Additional information
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.
We are seeing exactly the same, there doesn't seem to be any pattern to this, it makes our deployment pipelines fail from time to time.
We also see the 'org cannot be found error' message since a couple of weeks. We see it with the sfdx force:source:deploy command. sfdx sfdx-cli/7.156.1 (linux) and sfdx-cli/7.167.2 win32-x64.
error: ERROR running force:source:deploy: Metadata API request failed: The org cannot be found
We are now also seeing this on other commands; we use the sfpowerkit plugin to create a pool of scratch orgs and our pipeline throws this error intermittendly:
ERROR running sfpowerkit:pool:create: Unable to execute command .. Domain Not Found: The org cannot be found
This is on CLI 7.163.0:
{
"cliVersion": "sfdx-cli/7.163.0",
"architecture": "linux-x64",
"nodeVersion": "node-v16.13.1",
"pluginVersions": [
"@jayree/sfdx-plugin-legacy 1.1.0 (user)",
"@jayree/sfdx-plugin-manifest 2.3.0 (user)",
"@jayree/sfdx-plugin-prettier 1.2.0 (user)",
"@oclif/plugin-autocomplete 1.3.0 (core)",
"@oclif/plugin-commands 2.2.0 (core)",
"@oclif/plugin-help 2.2.3 (user)",
"@oclif/plugin-not-found 2.3.1 (core)",
"@oclif/plugin-plugins 2.1.0 (core)",
"@oclif/plugin-update 3.0.0 (core)",
"@oclif/plugin-version 1.1.2 (core)",
"@oclif/plugin-warn-if-update-available 2.0.4 (core)",
"@oclif/plugin-which 2.1.0 (core)",
"alias 2.1.0 (core)",
"apex 1.1.0 (core)",
"auth 2.2.3 (core)",
"community 2.0.0 (core)",
"config 1.4.17 (core)",
"custom-metadata 2.0.0 (core)",
"data 2.1.1 (core)",
"generator 2.0.2 (core)",
"info 2.0.1 (core)",
"limits 2.0.1 (core)",
"org 2.0.7 (core)",
"schema 2.1.1 (core)",
"signups 1.2.0 (core)",
"source 2.0.11 (core)",
"telemetry 2.0.0 (core)",
"templates 55.1.0 (core)",
"trust 2.0.3 (core)",
"user 2.1.0 (core)",
"@salesforce/sfdx-plugin-lwc-test 1.0.0 (core)",
"dxb 1.7.12 (user)",
"salesforce-alm 54.7.1 (core)",
"sfdmu 4.15.1 (user)",
"sfdx-browserforce-plugin 2.9.1 (user)",
"sfdx-jayree 4.3.18 (user)",
"sfpowerkit 5.0.0 (user)",
"texei-sfdx-plugin 1.17.0 (user)"
],
"osVersion": "Linux 5.15.0-1019-azure",
"shell": "bash",
"rootPath": "/usr/local/lib/nodejs/lib/node_modules/sfdx-cli"
}
The same issue happens from time to time with command force:mdapi:deploy after upgrade from 7.129.0 to 7.164.2:
ERROR running force:mdapi:deploy: Metadata API request failed: The org cannot be found
Hi @mshanemc: is this something you can help with? I see this error at least daily in our CI pipeline
This error is being thrown from here:
https://github.com/forcedotcom/sfdx-core/blob/main/src/org/connection.ts#L265
When instantiating this class it tries to get the API version to use in requests from a local config value (sfdx config:set apiVersion=55.0 --global) or env var (SFDX_API_VERSION=55.0 sfdx force:org:create -
Workaround: skip the DNS check by setting SFDX_DISABLE_DNS_CHECK=true
or setting the API version using config:set or env var mentioned as mentioned above.
We will require some logs of a deployment without setting the API version to see what URL the dns resolver is getting.
To enable debug mode just set the env var DEBUG
to true, e.g.
export DEBUG=true
sfdx force:source:deploy ...
This might be related to this ongoing issue: https://status.salesforce.com/generalmessages/994
@cristiand391 thanks for the solution. We are not receiving the error anymore.
Should this be documented somewhere? Looks like SFDX_DISABLE_DNS_CHECK
optimize the deployment process. There is no point in trying to DNS check every time the metadata API return InProgress
while running force:source:deploy:report
and the API version is already cached.
Do you think of any issue if we leave this setting true
in our pipeline?
Seeing the same problem with sfdx:source:deploy. we run 7.174 on Ubuntu (Github Action). No apparent pattern with when it happens, but it has happened more often recently with multiple sandboxes on different instances (all EU at this point)
Multiple projects and environments experiencing this issue. Can someone confirm that SFDX_DISABLE_DNS_CHECK
actually exists? It's not listed in the documentation, and doesn't seem to completely fix the issue.
@slaght yes, the method that does the dns lookup checks if it's set here: https://github.com/forcedotcom/sfdx-core/blob/main/src/status/myDomainResolver.ts#L76
If you run SFDX_DISABLE_DNS_CHECK=true DEBUG=* sfdx force:source:deploy:report
you should see this message in the log output:
SFDX_DISABLE_DNS_CHECK set to true. Skipping DNS check...
Same issue with force:source:deploy (sfdx-cli/7.177.1, GitHub action). Happens sporadically, no apparent pattern.
I just got a stack trace on this, waiting for a deployment to complete. Super weird that this is happening during deployment when it has been successfully interacting with this org for an extended time. This one failed 24 minutes into a 60 minute wait timeout. No reliable pattern but I usually see it a few times a week at a minimum. (probably 5% of runs if I had to guess)
I have not applied the SFDX_DISABLE_DNS_CHECK
env var, I'll be doing that later to see if it helps this problem go away.
sfdx force:mdapi:deploy --deploydir distDiff --testlevel RunLocalTests --targetusername [redacted] --wait 60 --json
{
"result": {
"id": "[redacted]"
},
"status": 1,
"name": "MetadataTransfer",
"message": "Metadata API request failed: The org cannot be found",
"exitCode": 1,
"context": "Deploy",
"data": {
"id": "[redacted]"
},
"stack": "MetadataTransferError: Metadata API request failed: The org cannot be found\n at MetadataApiDeploy.pollStatus (/usr/local/lib/sfdx/node_modules/@salesforce/source-deploy-retrieve/lib/src/client/metadataTransfer.js:83:27)\n at async Deploy.deploy (/usr/local/lib/sfdx/node_modules/@salesforce/plugin-source/lib/commands/force/mdapi/deploy.js:78:33)\n at async Deploy.run (/usr/local/lib/sfdx/node_modules/@salesforce/plugin-source/lib/commands/force/mdapi/deploy.js:25:9)\n at async Deploy._run (/usr/local/lib/sfdx/node_modules/@salesforce/command/lib/sfdxCommand.js:102:40)\n at async Config.runCommand (/usr/local/lib/sfdx/node_modules/@oclif/core/lib/config/config.js:272:25)\n at async run (/usr/local/lib/sfdx/node_modules/@oclif/core/lib/main.js:76:5)\nDUE TO:\nDomainNotFoundError: The org cannot be found\n at Messages.createError (/usr/local/lib/sfdx/node_modules/@salesforce/core/lib/messages.js:446:16)\n at Connection.isResolvable (/usr/local/lib/sfdx/node_modules/@salesforce/core/lib/org/connection.js:222:28)\n at async Connection.retrieveMaxApiVersion (/usr/local/lib/sfdx/node_modules/@salesforce/core/lib/org/connection.js:180:9)\n at async getConnectionNoHigherThanOrgAllows (/usr/local/lib/sfdx/node_modules/@salesforce/source-deploy-retrieve/lib/src/client/metadataTransfer.js:216:27)\n at async MetadataApiDeploy.checkStatus (/usr/local/lib/sfdx/node_modules/@salesforce/source-deploy-retrieve/lib/src/client/metadataApiDeploy.js:275:28)\n at async MetadataApiDeploy.poll (/usr/local/lib/sfdx/node_modules/@salesforce/source-deploy-retrieve/lib/src/client/metadataTransfer.js:158:31)\n at async doPoll (/usr/local/lib/sfdx/node_modules/@salesforce/core/lib/status/pollingClient.js:60:26)",
"warnings": [],
"commandName": "Deploy"
}
A little behind on versions:
$ sfdx --version
sfdx-cli/7.173.0 linux-x64 node-v16.17.1
$ sfdx plugins --core
@oclif/plugin-autocomplete 1.3.1 (core)
@oclif/plugin-commands 2.2.0 (core)
@oclif/plugin-help 5.1.14 (core)
@oclif/plugin-not-found 2.3.3 (core)
@oclif/plugin-plugins 2.1.1 (core)
@oclif/plugin-update 3.0.2 (core)
@oclif/plugin-version 1.1.2 (core)
@oclif/plugin-warn-if-update-available 2.0.6 (core)
@oclif/plugin-which 2.1.0 (core)
@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)
alias 2.1.5 (core)
apex 1.3.0 (core)
auth 2.2.14 (core)
community 2.0.7 (core)
config 1.4.21 (core)
custom-metadata 2.0.1 (core)
data 2.1.4 (core)
generator 2.0.6 (core)
info 2.1.10 (core)
limits 2.0.5 (core)
org 2.2.9 (core)
packaging 1.9.4 (core)
salesforce-alm 54.8.1 (core)
schema 2.1.10 (core)
sfdx-cli 7.173.0 (core)
sfdx-devops 0.4.9
sfdx-git-delta 5.5.0
sfdx-heber 0.0.2
shane-sfdx-plugins 4.[43](https://git.doterra.net/development/salesforce/-/jobs/1147686#L43).0
├─ @mshanemc/plugin-streaming 1.1.7
└─ @mshanemc/sfdx-sosl 1.1.0
signups 1.2.7 (core)
source 2.0.19 (core)
telemetry 2.0.2 (core)
templates [55](https://git.doterra.net/development/salesforce/-/jobs/1147686#L55).1.0 (core)
trust 2.0.4 (core)
user 2.1.12 (core)
We are affected by this too. A complete waste of CI/CD pipeline resources.
Edit 2: It seemed to make it a bit better, but not solved the issue entirely
Edit: with export SFDX_DISABLE_DNS_CHECK=true
it now seems to work.
We're experiencing this issue as well:
ERROR running force:source:deploy: Metadata API request failed: The org cannot be found
Tried SFDX_DISABLE_DNS_CHECK=true
and setting the API Version and even tried older CLI Versions (7.178.0, 7.175.0, and 7.170). Nothing helped.
Different Salesforce Orgs, same error.
Until three days ago, it only happened occasionally, now it happens almost every time.
+1
Impacting CI/CD pipeline.
ERROR
running force:source:deploy:
Metadata API request failed: The org cannot be found
Thank you very much @cristiand391 !!!!
Workaround works in my pipeline
npm install sfdx-cli --global
sfdx config:set apiVersion=56.0 --global
export SFDX_DISABLE_DNS_CHECK=true
Still encountering the issue on any of my connected orgs. It is also incredibly frequent for me. From 10 deployments maybe around 2 even start and none can keep the connection till the end. Issue occurs with all source commands: retrieve, deploy, push, pull
I set the recommended vars and running the recommended LTS node version.
Same here. I tried everything posted here. I tried changing the version of Salesforce CLI and Node JS to older versions, but nothing works...
I have this error
Azure Devops Pipelines with Hosted Agent (ubuntu-latest)?
Azure Devops Pipelines with Hosted Agent (ubuntu-latest)?
Yes
I'm looking at this, in the screenshot @HerrX2000 posted above I see the err is coming from the deploy library so it might be skipping the env var. Can someone post the full debug of a force:source:push
?
I resolved the problem (at least, for the moment) using older versions from Node JS and Salesforce CLI, 18.12.1 and 7.155.1, and it seems that works, 3 of 3 deployments without errors. I use the SFDX_DISABLE_DNS_CHECK=true but 'm not sure if it do something.
@cristiand391 thanks for pointing out that it might be skipping the env var. Indeed my .bashrc was wrong. It set the var for the bash environment, instead of as global env var. It now works, thank you very much.
Wrong .bashrc:
SFDX_DISABLE_DNS_CHECK=true
export $SFDX_DISABLE_DNS_CHECK
Correct .bashrc line:
export SFDX_DISABLE_DNS_CHECK=true
The export is mandatory, otherwise the variable is not available within the context of sfdx.
This issue has been linked to a new work item: W-12129008
Following. We are also getting the same error and unfortunately I am still getting the same after adding export SFDX_DISABLE_DNS_CHECK=true
npm install sfdx-cli --global sfdx config:set apiVersion=56.0 --global export SFDX_DISABLE_DNS_CHECK=true
Unfortunately, this doesn't remediate.
Code deploys, however pipelines fails.
To double check if the variable is exported correctly, you can run export | grep SFDX
.
@ZanePearton @derrick-ejan-rs
Maybe this helps. My deployment now shows
(node:65603) Warning: Network error occurred. Continuing to poll.
. Maybe its a symptom of how the deploy library handles short network outages. I am on WIFI, so this could be what caused the DNS check to fail for me.