2

After running sfdx force:mdapi:deploy -d directory -u Production, It runs successfully and queue the deployment and gives the below message To check the status of this deployment, run "sfdx force:mdapi:deploy:report"

and once I run sfdx force:mdapi:deploy:report then instead of showing the deployment status it gives below error

ERROR running force:mdapi:deploy:report: INVALID_CROSS_REFERENCE_KEY: invalid cross reference id

after wasting plenty of time with dx I deployed the same with changeset and it got deployed successfully without any error.

Could someone please suggest the reason for this error?

  • 1
    Just curious, it sounds like the deployment actually failed, since you ultimately completed it via change set. Were you able to establish why it failed? – David Reed Jul 3 at 12:16
2

If your default org is not set to Production (which it likely is not - usually it's set to the current scratch org or sandbox that you're developing on), then you need to specify the org which you want to see the deployment status for.

You need the -u flag and point to your sfdx logged in Production org:

sfdx force:mdapi:deploy:report -u MyProductionOrgAlias

Bonus

In the original sfdx deploy command, try adding the -w flag with the number of minutes to wait, and you'll get auto-reporting in your terminal! No need to run the above reporting command

sfdx force:mdapi:deploy ... -w 5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.