cli icon indicating copy to clipboard operation
cli copied to clipboard

Source deploy fails - ERROR running force:source:deploy: Metadata API request failed: <!DOCTYPE html>

Open jefersonchaves opened this issue 2 years ago • 3 comments

Summary

Deploying to a sandbox with Salesforce Edge enabled intermittently fails on SFDX but deployment works, causing CI to report incorrectly.

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc

*NOTE: the deployment does not seem to be relevant, it seems to be the polling logic that can fail when Salesforce Edge returns an unexpected error

  1. Enable Salesfore Edge network on sandbox: Route My Domain Through Salesforce Edge Network.
  2. sfdx force:source:deploy --targetusername DeployUser --sourcepath force-app --testlevel NoTestRun --verbose

Expected result

The deployment status should be returned (either in progress, success, or error) with a retry logic for such network issues on Salesforce.

Actual result

An error is generated, and the process is stopped with the following HTML (the most important part is at the bottom This error originated from Salesforce Edge): sfdxErrorMessage.txt

This seems to be related to #1169 and/or #860.

It was initially logged as support ticket # 42186728.

System Information

  • It has used purely the sfdx from docker hub: https://hub.docker.com/layers/salesforce/salesforcedx/7.143.0-full/images/sha256-bc22c79683ef61d62b250cc2f9d68b0e24a31f096d43fa5934efc6cf787b1d83

jefersonchaves avatar Apr 20 '22 18:04 jefersonchaves

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.

github-actions[bot] avatar Apr 20 '22 18:04 github-actions[bot]

We have determined that the issue you reported exists in code owned by another team that uses only the official support channels. To ensure that your issue is addressed, open an official Salesforce customer support ticket with a link to this issue. We encourage anyone experiencing this issue to do the same to increase the priority. We will keep this issue open for the community to collaborate on.

github-actions[bot] avatar May 10 '22 20:05 github-actions[bot]

This issue has been linked to a new work item: W-11127569

uip-robot-zz avatar May 10 '22 20:05 uip-robot-zz

Same here ;) (up)

renanlq avatar May 12 '23 17:05 renanlq

@renanlq that error got retries added to it a long time ago. What CLI version are you on?

mshanemc avatar May 12 '23 18:05 mshanemc

Hi @mshanemc, sorry for, we got some more information and noticed from our site that the problem is about network connection

ERROR running force:source:deploy:  Metadata API request failed: FUNCTIONALITY_TEMPORARILY_UNAVAILABLE: Failed while fetching query cursor data for this QueryLocator (org 00D*******jT6, path 0r8x*******q7G), please retry your request.

So that I'm moving my comments to this topic: https://github.com/forcedotcom/cli/issues/1811, that seems to be similar.

renanlq avatar May 15 '23 18:05 renanlq

is handled now. Forgot to update the issue.

https://github.com/forcedotcom/source-deploy-retrieve/blob/64132ca9a3353dda8810658bd077e495923cfba5/src/client/metadataTransfer.ts#L233

mshanemc avatar Jul 17 '23 15:07 mshanemc

We're still seeing this with @salesforce/[email protected]. Almost all our deployment validations fail immediately after starting:

Deploying v57.0 metadata to $USERNAME using the v59.0 SOAP API.
Deploy ID: 0Af8E0000303TvGSAU
Error (1): Metadata API request failed: <!doctypehtml><html lang=en-US><meta charset=UTF-8><title>Error Page</title> ...

The HTML response looks like this when rendered:

image

hsmork avatar Oct 04 '23 09:10 hsmork

Same as @hsmork . Just saw this issue again in VS code today and confirmed the Salesforce Deployment Status page was re-directed to the above "An unexpected connection error occured". I'm also using @salesforce/[email protected].

mcarvin8 avatar Nov 01 '23 17:11 mcarvin8

Our current workaround is to start validation jobs asynchronously with sf project deploy validate --async and then manually poll for updates with sf project deploy report --job-id "${validation_id}" until the job is done.

hsmork avatar Nov 01 '23 18:11 hsmork

Makes sense. Running asynchronously definitely would avoid these types of metadata API request failures that I've seen when running synchronously and the jobs take a bit, especially in production.

But hopefully a new CLI can handle these types of failures running synchronously in the future.

What frequency are you polling for updates if I may ask, @hsmork ? Debating about implementing this into our CI pipelines.

Currently when we run into this metadata API request failures, we just monitor the Deployment directly in Salesforce and hit the quick-deploy button manually if it's a validation. I have scripts which print the Salesforce Deploy Status URL once the ID is created which is nice when these failures happen. But running async sounds like a decent workaround to getting reliable CI job statuses in terms of making sure they match the Salesforce status.

mcarvin8 avatar Nov 01 '23 18:11 mcarvin8