cli icon indicating copy to clipboard operation
cli copied to clipboard

sf project generate manifest --from-org generates a manifest with unavailable metadata for specified org

Open MarcTCruz opened this issue 1 year ago • 7 comments

Note Before you submit your issue, make sure that:

  • You're using the latest version of Salesforce CLI. sf --version @salesforce/cli/2.29.5 linux-x64 node-v20.11.0

Summary

"sf project generate manifest --from-org" generating unavailable metadata for specified org.

Steps To Reproduce

sf project generate --name org --template empty
cd ./org
sf org login web --alias Homologation --instance-url https://test.salesforce.com
sf config set target-org Homologation
sf project generate manifest --from-org Homologation --output-dir ./manifest

IMPORTANT Provide a repository that's configured to reproduce the issue. If you are unable to provide a repo, please explain why not. The more info we have from the start, the faster we can resolve your issue. I am unbable to provide a repository as it happens on a just refreshed partial sandbox from a real organization, not a trailhead org.

Expected result

It should probably only retrieve metadata available to the org.

Actual result

In the result file there are unavailable tags like this:

    <types>
        <members>StepD2</members>
        <members>StepD4</members>
        <members>TeleVendasAtivo</members>
        <members>negociacaoPaginaRegistro</members>
        <name>UiViewDefinition</name>
    </types>

sf project retrieve start --metadata UiViewDefinition Retrieving v60.0 metadata from [email protected] using the v60.0 SOAP API Preparing retrieve request... Succeeded › Warning: Nothing retrieved

Warnings

| File Problem
| ────────────────────── ──────────────────────────────────────────────────────────────────── | unpackaged/package.xml Entity type 'UiViewDefinition' is not available in this organization

System Information

/bin/bash xterm-256color

{
  "architecture": "linux-x64",
  "cliVersion": "@salesforce/cli/2.29.5",
  "nodeVersion": "node-v20.11.0",
  "osVersion": "Linux 6.5.0-18-generic",
  "rootPath": "/usr/local/bin/sf_files",
  "shell": "bash",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.8 (core)",
    "@oclif/plugin-commands 3.1.3 (core)",
    "@oclif/plugin-help 6.0.12 (core)",
    "@oclif/plugin-not-found 3.0.10 (core)",
    "@oclif/plugin-plugins 4.2.2 (core)",
    "@oclif/plugin-search 1.0.14 (core)",
    "@oclif/plugin-update 4.1.11 (core)",
    "@oclif/plugin-version 2.0.12 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.10 (core)",
    "@oclif/plugin-which 3.0.15 (core)",
    "@salesforce/cli 2.29.5 (core)",
    "apex 3.0.23 (core)",
    "auth 3.3.11 (core)",
    "data 3.0.20 (core)",
    "deploy-retrieve 3.2.14 (core)",
    "functions 1.22.11 (user)",
    "info 3.0.24 (core)",
    "limits 3.1.8 (core)",
    "marketplace 1.0.22 (core)",
    "org 3.3.12 (core)",
    "packaging 2.1.7 (core)",
    "schema 3.1.3 (core)",
    "settings 2.0.24 (core)",
    "sobject 1.1.11 (core)",
    "source 3.1.13 (core)",
    "telemetry 3.1.11 (core)",
    "templates 56.0.14 (core)",
    "trust 3.3.8 (core)",
    "user 3.2.8 (core)"

Additional info: VSCode extensions as Aura Helper and SFDX Package.xml do not show those unavailable metadata, there are lot of those, above is just an example.

MarcTCruz avatar Feb 23 '24 13:02 MarcTCruz

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 Feb 23 '24 13:02 github-actions[bot]

Hey @MarcTCruz, could you clarify something your "Steps to reproduce"? What org are you logging into when you run sf org login web --alias Homologation --instance-url https://test.salesforce.com?

Based on what you shared, it looks like you are generating the files of a new project (sf project generate --name org --template empty) but you are not actually creating the org itself. It looks like you might be signing into an unrelated org or devhub, assigning an alias during login, and then generating a manifest in your current directory from a different org.

FWIW, I am not seeing UiViewDefinition in my manifest when I run:

sf project generate --name emptyorg --template empty
cd ./emptyorg
sf org create scratch --set-default --definition-file config/project-scratch-def.json --alias emptyorg
sf org list
sf project generate manifest --from-org emptyorg --output-dir ./manifest
cat ./manifest/package.xml | grep "UiViewDefinition"

iowillhoit avatar Feb 23 '24 20:02 iowillhoit

@iowillhoit. It is a partial sandbox. Mentioned on my opening post:

I am unbable to provide a repository as it happens on a just refreshed partial sandbox from a real organization, not a trailhead org.

FWIW, I am not seeing UiViewDefinition in my manifest when I run: I don't see it when using a trailhead or a clear org as well but this is retrieved for some reason when retrieving using "sf project generate manifest --from-org emptyorg --output-dir ./manifest"

The weird thing is that it shows in the package.xml and it is not the only metadata showing that does not exist in the org. E.g.:

sf project retrieve start --metadata UiViewDefinition
Retrieving v60.0 metadata from [email protected] using the v60.0 SOAP API
Preparing retrieve request... Succeeded
 ›   Warning: Nothing retrieved

Warnings
=============================================================================================
| File                   Problem                                                              
| ────────────────────── ──────────────────────────────────────────────────────────────────── 
| unpackaged/package.xml Entity type 'UiViewDefinition' is not available in this organization 

Also, there are some errors like these:

sf project retrieve start --metadata "ContentAsset:download"
Retrieving v60.0 metadata from [email protected] using the v60.0 SOAP API
Preparing retrieve request... MetadataTransferError
Error (1): Metadata API request failed: unpackaged/contentassets/download.asset-meta.xml: Expected source files for type 'ContentAsset'

Below some handpicked parts of package.xml generated with the from-org command:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <types>
      <members>StepD2</members>
      <members>StepD4</members>
      <name>UiViewDefinition</name>
  </types>
  <types>
      <members>download</members>
      <members>Joinpng</members>
      <members>Joinpng1</members>
      <members>Joinpng2</members>
      <members>Joinpng3</members>
      <members>Joinpng4</members>
      <members>Joinpng5</members>
      <name>ContentAsset</name>
    </types>
    <types>
      <members>AdvAcctForecastSetPartner.All_AdvAcctForecastSetPartners</members>
      <members>AdvAcctForecastSetPartner.My_AdvAcctForecastSetPartners</members>
    <name>ListView</name>
</types>
<version>60.0</version>
</Package>
sf project retrieve start -x ./manifest/handpicked.xml 
Retrieving v60.0 metadata from [email protected] using the v60.0 SOAP API
Preparing retrieve request... MetadataTransferError
Error (1): Metadata API request failed: unpackaged/contentassets/Joinpng4.asset-meta.xml: Expected source files for type 'ContentAsset'

Following command does not output the "broken" metadata that "sf project generate manifest --from-org" does. sf force mdapi describemetadata --api-version 60.0 --json >> availableMetadata.json availableMetadata.json

MarcTCruz avatar Feb 25 '24 20:02 MarcTCruz

Hey @MarcTCruz, sorry I missed the mention of a partial sandbox. Could you please provide the full output of the retrieve commands with the --dev-debug flag? That will give us some more info. I will check with some team members about partial sandboxes

iowillhoit avatar Feb 28 '24 22:02 iowillhoit

@iowillhoit, I found out it some ContentAssets not having ContentVersions maybe due to permissions or it can be due to partial copy.

E.g.:

SELECT FIELDS(ALL) FROM ContentAsset LIMIT 10(10 rows)
"_","Id","IsDeleted","DeveloperName","CreatedDate"
"[ContentAsset]","03S5f000001BGzYEAW","false","Sales","2021-12-15T14:22:44.000+0000"
"[ContentAsset]","03S5f000001BGzZEAW","false","relationship_management","2021-12-15T14:22:44.000+0000"
"[ContentAsset]","03S5f000001BGzaEAG","false","Lead_generation","2021-12-15T14:22:44.000+0000"
"[ContentAsset]","03S5f000001BGzbEAG","false","Sales_operation","2021-12-15T14:22:44.000+0000"
"[ContentAsset]","03S5f000001BGzcEAG","false","Sales_leadersship","2021-12-15T14:22:44.000+0000"
"[ContentAsset]","03S5f000001CQqpEAG","false","BBA","2022-01-17T14:05:04.000+0000"
"[ContentAsset]","03S5f000001CQqqEAG","false","belgo","2022-01-17T14:05:05.000+0000"
"[ContentAsset]","03S5f000001CRdVEAW","false","X452_054_21_af_logo_belgo_portal_cli","2022-01-21T13:24:05.000+0000"
"[ContentAsset]","03S5f000001CSCdEAO","false","ryanparker26kL6D1ixYMunsplash","2022-01-27T15:17:40.000+0000"
"[ContentAsset]","03S5f000001CSCsEAO","false","ryanparker26kL6D1ixYMunsplash1","2022-01-27T15:42:18.000+0000"
SELECT Id, IsDeleted, ContentDocumentId,  CreatedDate FROM ContentVersion LIMIT 10 (5 rows)
"_","Id","IsDeleted","ContentDocumentId","CreatedDate"
"[ContentVersion]","068Ha000000PsurIAC","false","069Ha000000Q46PIAS","2024-02-26T18:25:01.000+0000"
"[ContentVersion]","068Ha000000R47aIAC","false","069Ha000000RFFuIAO","2024-03-05T13:58:40.000+0000"
"[ContentVersion]","068Ha000000R4XNIA0","false","069Ha000000RFfhIAG","2024-03-05T14:11:40.000+0000"
"[ContentVersion]","068Ha000000PwyUIAS","false","069Ha000000Q8DGIA0","2024-02-27T11:12:55.000+0000"
"[ContentVersion]","068Ha000000PZFVIA4","false","069Ha000000PkKbIAK","2024-02-22T20:34:31.000+0000"

I though all ContentDocument should have a ContentVersion, but it shows for me like it is not true or I lack access for such. Either way, it is probably the cause of the error: "Expected source files for type 'ContentAsset'".

@iowillhoit I'll provide some --dev-debug.

MarcTCruz avatar Mar 05 '24 21:03 MarcTCruz

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

github-actions[bot] avatar Mar 14 '24 01:03 github-actions[bot]

Error(1): ContentAsset.txt

Improper input: ConnectedApp.txt TopicsForObjects.txt

Not available but shows in sf project generate manifest: UiViewDefinition.txt

@iowillhoit

MarcTCruz avatar Mar 18 '24 15:03 MarcTCruz

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

github-actions[bot] avatar Mar 26 '24 01:03 github-actions[bot]

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

github-actions[bot] avatar Apr 03 '24 01:04 github-actions[bot]