forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
493 stars 78 forks source link

invalid cross reference id when creating new package version #2133

Closed barak-11 closed 1 year ago

barak-11 commented 1 year ago

Summary

Unable to create new package version for unlocked packages. getting:

Error (1): Multiple errors occurred: 
(1) my_app: invalid cross reference id

Steps To Reproduce:

  1. update sf-cli to @salesforce/cli/1.77.6 darwin-arm64 node-v19.9.0 or sfdx-cli to 7.200.7
  2. Include profileActionOverrides tag in the lightning application
    <profileActionOverrides>
        <actionName>View</actionName>
        <content>General_Contact</content>
        <formFactor>Large</formFactor>
        <pageOrSobjectType>Contact</pageOrSobjectType>
        <recordType>Contact.Customer</recordType>
        <type>Flexipage</type>
        <profile>Customer</profile>
    </profileActionOverrides>
  3. run sf package version create --package "myPackage" -x --wait 100 or run sfdx package:version:create -p "myPackage" -x -w 100

Expected result

expected it work as it did the day before I upgraded the sf-cli. Version create.... Create version status: Success

Actual result

Error (1): Multiple errors occurred: 
(1) my_app: invalid cross reference id

System Information

using zsh on Mac Ventura

{
  "cliVersion": "@salesforce/cli/1.77.6",
  "architecture": "darwin-arm64",
  "nodeVersion": "node-v19.9.0",
  "osVersion": "Darwin 22.3.0",
  "shell": "zsh",
  "rootPath": "/opt/homebrew/lib/node_modules/@salesforce/cli",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 2.1.9 (core)",
    "@oclif/plugin-commands 2.2.14 (core)",
    "@oclif/plugin-help 5.2.9 (core)",
    "@oclif/plugin-not-found 2.3.23 (core)",
    "@oclif/plugin-plugins 3.0.1 (core)",
    "@oclif/plugin-search 0.0.17 (core)",
    "@oclif/plugin-update 3.1.13 (core)",
    "@oclif/plugin-version 1.3.3 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.36 (core)",
    "@oclif/plugin-which 2.2.19 (core)",
    "@salesforce/cli 1.77.6 (core)",
    "apex 2.2.15 (core)",
    "auth 2.7.14 (core)",
    "data 2.3.14 (core)",
    "deploy-retrieve 1.8.18 (core)",
    "info 2.6.10 (core)",
    "limits 2.3.13 (core)",
    "login 1.2.8 (core)",
    "org 2.7.3 (core)",
    "packaging 1.16.11 (user)",
    "schema 2.3.10 (core)",
    "settings 1.4.6 (core)",
    "sobject 0.1.18 (core)",
    "source 2.10.7 (core)",
    "telemetry 2.2.0 (core)",
    "templates 55.4.13 (core)",
    "trust 2.4.14 (core)",
    "user 2.3.10 (core)"
  ]
}

Additional information

Was able to resolve it by reverting to old sfdx version 7.196.9 and executing: sfdx package:version:create -p "myPackage" -x -w 100. Another way to resolve it is just to remove the profileActionOverrides but that doesn't really help.

github-actions[bot] commented 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.

mshanemc commented 1 year ago

please see: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_profileactionoverride.htm?q=profileActionOverrides

ProfileActionOverrides aren’t supported in packaging. They’re supported in change sets, but you have to add them manually.

We had a recent bug with certain node versions where that command would "succeed" but not really.
general issues with node 18.16.0. You might be getting the proper error now instead of a false negative.

arafesthain commented 1 year ago

@mshanemc just saw that ProfileActionOverrides cannot be used in package but was working fine since a long time. Also Profiles meta are (at least it seems) not pushed anymore in the package version create phase (IMHO that's the verry root cause of the error for @barak-11 and me) I have a Unit test that is failing when querying the needed profile. I can open a different issue if needed. But I first came here due to the profile was not found anymore in profileActionOverides (error is coming from missing profile and not unpackageable profileActionOveride)

{
  "cliVersion": "sfdx-cli/7.201.6",
  "architecture": "linux-x64",
  "nodeVersion": "node-v18.15.0",
  "osVersion": "Linux 5.15.0-1037-azure",
  "shell": "bash"
}
iowillhoit commented 1 year ago

Hello @barak-11, you mentioned that this just recently stopped working. Can you please try a few more versions and narrow down the exact CLI version in which this broke? That will make it easier to track down what changed.

arafesthain commented 1 year ago

hello @iowillhoit I tried to revert to the last Success build sfdx version (7.194.1) but did not help. The package version create is failing even with version where it was working fine.

Error (1): Multiple errors occurred: 
(1) FS_Change_Requests _(ligthning app metadata)_ : invalid cross reference id

{ "cliVersion": "sfdx-cli/7.194.1", "architecture": "linux-x64", "nodeVersion": "node-v18.15.0" }

mshanemc commented 1 year ago

If no CLI versions work anymore, that adds support for the theory that the packaging process changed to align with the docs.

arafesthain commented 1 year ago

@mshanemc yes you right. that's why if you look into my previous comment I tried to remove profileActionOveriddes from the picture. I don't think there is anything link to profileActionOveriddes. The problem comes from custom Profile (in our case) that cannot be found.

2153

iowillhoit commented 1 year ago

Closing this issue as it seems that the process now matches the documentation as Shane mentioned. Will continue the other discussion in 2153

arafesthain commented 1 year ago

2192