Closed jdgirald closed 1 year ago
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.
To confirm that the DNS check is being skipped you set the debug env var to only show the logs from the domain resolver, you should see sf:MyDomainResolver DEBUG SFDX_DISABLE_DNS_CHECK set to true. Skipping DNS check...
in the logs.
Here's an example running:
DEBUG=sf:MyDomainResolver SFDX_DISABLE_DNS_CHECK=true sfdx force:source:deploy -u easy-spaces --sourcepath es-base-objects/
@cristiand391 thanks that looks like it worked for me.
do you have any fix to Metadata API request failed: The org cannot be found"
? This is a blocker for our CI pipelines
shoud we try to use export SFDX_DISABLE_DNS_CHECK=true
? Is this an official workaround for this problem?
or is there any different command which works fine, like sfdx force:beta:source:push
to have it stable?
@bdovh yes, I mentioned it here: https://github.com/forcedotcom/cli/issues/1713#issuecomment-1298701282
that env var should work for all commands as the domain resolver is the same.
To confirm that the check is being skipped you can enable the debug output, see https://github.com/forcedotcom/cli/issues/1713#issuecomment-1330596767
shoud we try to use
export SFDX_DISABLE_DNS_CHECK=true
? Is this an official workaround for this problem?
@bdovh yes that is what worked for me. We are using Azure pipelines.
shoud we try to use
export SFDX_DISABLE_DNS_CHECK=true
? Is this an official workaround for this problem?@bdovh yes that is what worked for me. We are using Azure pipelines.
I am using Github Action CI pipelines and it still doesn't help. Well, it randomly fails, not every time, but once per two tries
So far this has been working for me in GitHub Actions
- name: Deploy without test classes
shell: bash
env:
SFDX_DISABLE_DNS_CHECK: true
run: >-
sfdx force:source:deploy -x ${{env.PACKAGEXML_FILE}} -u
${{env.SF_USERNAME}} -w 10000 --verbose --loglevel fatal
Still experience issues with network connection during the long deployment. After adding export SFDX_DISABLE_DNS_CHECK=true in the pipeline we don have "The org cannot be found" error, but there is another one
ERROR running force:source:deploy:report: Metadata API request failed: request to ....sandbox.my.salesforce.com/services/Soap/m/56.0 failed, reason: Client network socket disconnected before secure TLS connection was established
So far this has been working for me in GitHub Actions
- name: Deploy without test classes shell: bash env: SFDX_DISABLE_DNS_CHECK: true run: >- sfdx force:source:deploy -x ${{env.PACKAGEXML_FILE}} -u ${{env.SF_USERNAME}} -w 10000 --verbose --loglevel fatal
let me try that one
shoud we try to use
export SFDX_DISABLE_DNS_CHECK=true
? Is this an official workaround for this problem?@bdovh yes that is what worked for me. We are using Azure pipelines.
I am using Github Action CI pipelines and it still doesn't help. Well, it randomly fails, not every time, but once per two tries
This is what Salesforce support has confirmed as official workaround.
FYI: sfdx v7.180.0 (latest-rc) includes a fix for this, see rel notes: https://github.com/forcedotcom/cli/tree/main/releasenotes/sfdx#71800-dec-8-2022-stable-rc
ERROR running force:source:deploy:report: Metadata API request failed: request to ....sandbox.my.salesforce.com/services/Soap/m/56.0 failed, reason: Client network socket disconnected before secure TLS connection was established
@steals that's a different network error, if you can please open a new GH issue and provide a debug log of the CLI.
Hi @cristiand391
I know it is a stretch question, but based on a lot of the comments above, it seems also to happen for force:source:deploy
and not just force:source:deploy:report
.
Do you know if the fix will also apply to force:source:deploy
?
@nickytorstensson the fix was done on the sfdx-core library: https://github.com/forcedotcom/sfdx-core/pull/712
The fix should apply to all commands that interact with an org as the connections to it are done using sfdx-core.
As I mentioned in the comment below, the fix is included in the current release candidate, not in latest stable (the one most people use). See: https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli_rc.htm
If you are still getting the The org cannot be found
err with sfdx >= v7.180.0, please let us know.
🚀 sfdx 7.180.0 is now stable/GA with fixes for this issue. If you had been holding off installing during the RC period, you can now upgrade!
@nickytorstensson the fix was done on the sfdx-core library: forcedotcom/sfdx-core#712
The fix should apply to all commands that interact with an org as the connections to it are done using sfdx-core.
As I mentioned in the comment below, the fix is included in the current release candidate, not in latest stable (the one most people use). See: https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli_rc.htm
If you are still getting the
The org cannot be found
err with sfdx >= v7.180.0, please let us know.
I have a question, does it fix also the sfdx force:source:push
command?
@bdovh yes, it should.
is 7.180 GA?
Why when I try to execute the script
node --version npm install sfdx-cli --global export SFDX_DISABLE_DNS_CHECK=true echo "Version of SFDX CLI is: $(sfdx --version)"
it installs the version
Version of SFDX CLI is: sfdx-cli/7.179.0 linux-x64 node-v16.18.1
@bdovh yes, you can see the latest
tag points to 7.180.0:
➜ sf-plugin-api git:(cd/cleanup) ✗ npm show sfdx-cli dist-tags
{
latest: '7.180.0',
'latest-rc': '7.181.1',
dev: '7.177.0-dev.4',
'dev-rc': '7.177.0-dev.4'
}
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