2

I am trying to release an Unlocked 2GP package that has an Unlocked package dependency (UnofficialSF component), and when SF servers verify the dependencies I get the same error every time:

Error: You cannot install an unlocked package without a namespace into an org with a namespace.

It is my understanding that 2GP does NOT use any sort of packaging org (which would have been namespaced) to build the package, so I'm not sure what namespaced org this is flagging an error for. I have scoured SFDX's documentation as well as user forums and can't find anyone dealing with this same error.

I have tried releasing a package version using both CLI and CumulusCI, and I get the same error in both scenarios.

When listing packages in my Dev Hub:

Namespace Prefix  Name                                              Id                  Alias  Description  Type
ref02             Refugees-Support-Unlocked                         0Ho1U000000TNSaSAO                      Unlocked

For those familiar with CumulusCI the beginning of my CCI.yml file looks like:

project:
    name: Refugees-Support
    package:
        name: 'Refugees-Support-Unlocked'
        namespace: 'ref02'
        api_version: '50.0'
    dependencies:
        - github: 'https://github.com/SalesforceFoundation/PMM'
        - github: 'https://github.com/SalesforceFoundation/Relationships'
        - version_id: 04t4W00000309DuQAI
        - version_id: 04t5G0000047xO4QAI
        - version_id: 04t5G000003rUaWQAU

My prior sfdx-project file looked like this, for when running the release via SFDX CLI:

    "namespace": "ref02",
    "sourceApiVersion": "52.0",
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "package": "Refugees Support (Unlocked)",
            "versionName": "ver 0.1",
            "versionNumber": "0.1.0.NEXT",
            "definitionFile" : "orgs/release.json"
        }
    ],
    "dependencies": [
        {
            "package" : "[email protected]"           
        },
        {
            "package": "[email protected]"
        },
        {
            "package": "[email protected]"
        },
        {
            "package": "[email protected]"
        },
        {
            "package": "[email protected]"
        }
     ],
    "postInstallUrl": "https://github.com/Cath-Strategic-Tech/Refugees-Support/releases",
    "packageAliases": {
        "PMM": "04t6g000008C2xMAAS",
        "Relationships": "04t2E000003sm94QAA",
        "FlowActionsBasePack": "04t4W0000034KcuQAE",
        "FlowScreenComponentsBasePack": "04t5G0000047xO4QAI",
        "Datatable": "04t5G000003rUaWQAU",
        "Refugees Support (Unlocked)": "0Ho1U000000TNSQSA4"
    }
}

My sfdx-project when attempting the run via CumulusCI looks pretty simple:

{"packageDirectories": [{"path": "force-app", "default": true}], "namespace": null, "sourceApiVersion": "52.0"}

4
  • Are you creating the unlocked package with the namespace? Commented Jan 28, 2022 at 3:41
  • Initially I was, but then I attempted without namespace as well, received the same error. Commented Jan 28, 2022 at 19:11
  • Is your DevHub linked with a namespace? Commented Jan 28, 2022 at 23:03
  • Our DevHub has multiple namespaces linked to it, following the new process for releasing 2GP packages. Commented Jan 31, 2022 at 3:40

2 Answers 2

2

The issue is due to the Namespace collision rule criteria discussed here.

I am assuming that you are building a namespaced Unlocked package that has the dependencies on the non-Namespaced Unlocked package.

During unlocked package creation, the org is getting generated with a namespace in the backend and all the dependent unlocked packages are failing to install due to the conflict resolution rule here.

Some possible solutions to this issue is as below

  1. Create an unlocked package without a namespace

OR

  1. If dependent unlocked packages are open source, create your own package and package version with a namespace or alternatively incorporate the code in your package.

Also, I suggest, raising an idea on IdeaExchange to product teams to allow support your use case in the product.

2
  • 1
    +1 - another option is to vendor the 3rd-party unlocked package contents into your package, if open source.
    – David Reed
    Commented Jan 28, 2022 at 4:16
  • @DavidReed Good point! Let me bake that in as well as another option. Commented Jan 28, 2022 at 4:25
0

If You are trying to install the unlocked package using sfdx-cli then you must create a scratch org without a namespace. Use flag "-n" while creating scratch org using sfdx-cli.

sfdx force:org:create -f config/project-scratch-def.json -v DEVHUB_USER -a Org_alias -d 1 -n

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .