question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sfdx force\:package\:beta\:version\:create is breaking the sfdx-project.json file convention

See original GitHub issue

Summary

Using new package beta command & seeing bug (or at least undocumented breaking changes).

Steps To Reproduce:

  • Create a new unlock package version
  • See that the dependencies in the sfdx project.json is updated with a new format (not documented)

Expected result

image

package version:package version id

Actual result

image

There is now a subscriberPackageVersionId:[packageVersionId] format that is breaking our CI chain.

System Information

{
  "cliVersion": "sfdx-cli/7.172.0",
  "architecture": "linux-x64",
  "nodeVersion": "node-v16.17.1",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 1.3.3 (core)",
    "@oclif/plugin-commands 2.2.0 (core)",
    "@oclif/plugin-help 5.1.15 (core)",
    "@oclif/plugin-not-found 2.3.5 (core)",
    "@oclif/plugin-plugins 2.1.4 (core)",
    "@oclif/plugin-update 3.0.2 (core)",
    "@oclif/plugin-version 1.1.3 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.9 (core)",
    "@oclif/plugin-which 2.1.1 (core)",
    "alias 2.1.5 (core)",
    "apex 1.2.0 (core)",
    "auth 2.2.13 (core)",
    "community 2.0.3 (core)",
    "config 1.4.21 (core)",
    "custom-metadata 2.0.1 (core)",
    "data 2.1.4 (core)",
    "generator 2.0.5 (core)",
    "info 2.1.9 (core)",
    "limits 2.0.5 (core)",
    "org 2.2.7 (core)",
    "packaging 1.9.4 (core)",
    "schema 2.1.10 (core)",
    "signups 1.2.7 (core)",
    "source 2.0.17 (core)",
    "telemetry 2.0.2 (core)",
    "templates 55.1.0 (core)",
    "trust 2.1.0 (core)",
    "user 2.1.10 (core)",
    "@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)",
    "salesforce-alm [54](https://github.com/WorldlineSMI/sf-ps-arrow/actions/runs/3281841792/jobs/5404414163#step:5:55).8.1 (core)"
  ],
  "osVersion": "Linux 5.15.0-1020-azure",
  "shell": "unknown",
  "rootPath": "/home/runner/pnpm-global/5/node_modules/.pnpm/sfdx-cli@7.1[72](https://github.com/WorldlineSMI/sf-ps-arrow/actions/runs/3281841792/jobs/5404414163#step:5:73).0/node_modules/sfdx-cli"
}
  • Which shell/terminal are you using? (e.g. bash, zsh, powershell 5, powershell 7, cmd.exe, etc.) bash

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mrichbbcommented, Oct 31, 2022

@WillieRuemmele we are facing this issue as well with the new commands.

Did you ensure that the dreamhouse-lwc project has a dependency on another package before you create the package version?

Here is an illustration of what the file looks like before and after using the beta package version create command.

Before

{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "package": "DreamhouseLWC",
            "versionName": "Summer '22",
            "versionNumber": "55.0.0.NEXT",
            "dependencies": [
                {
                    "package": "my-package-dependency@1.00"
                }
            ]
        }
    ],
    "namespace": "",
    "sourceApiVersion": "55.0",
    "packageAliases": {
        "DreamhouseLWC": "0Ho3h000000PBghCAG",
        "DreamhouseLWC@55.0.0-3": "04t3h000004sq5YAAQ",
        "DreamhouseLWC@55.0.0-21": "04t3h000004bhxlAAA",
        "DreamhouseLWC@55.0.0-24": "04t3h000004mAlZAAU",
        "DreamhouseLWC@55.0.0-25": "04t3h000004mB2TAAU",
        "DreamhouseLWC@55.0.0-29": "04t3h000004mBEHAA2",
        "my-package-dependency@1.00": "04t3h00000XXXXXXXX"
    }
}

After

{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "package": "DreamhouseLWC",
            "versionName": "Summer '22",
            "versionNumber": "55.0.0.NEXT",
            "dependencies": [
                {
                    "subscriberPackageVersionId": "04t3h00000XXXXXXXX"
                }
            ]
        }
    ],
    "namespace": "",
    "sourceApiVersion": "55.0",
    "packageAliases": {
        "DreamhouseLWC": "0Ho3h000000PBghCAG",
        "DreamhouseLWC@55.0.0-3": "04t3h000004sq5YAAQ",
        "DreamhouseLWC@55.0.0-21": "04t3h000004bhxlAAA",
        "DreamhouseLWC@55.0.0-24": "04t3h000004mAlZAAU",
        "DreamhouseLWC@55.0.0-25": "04t3h000004mB2TAAU",
        "DreamhouseLWC@55.0.0-29": "04t3h000004mBEHAA2",
        "my-package-dependency@1.00": "04t3h00000XXXXXXXX",
        "DreamhouseLWC@55.0.0-30": "04t3h00000YYYYYYYY"
    }
}

Somewhat of a separate issue. After the version is created, the VS Code extensions also complain about the dependency missing a package name after the dependency section is re-written. Although referring to a dependency that way seems to be perfectly valid.

1reaction
WillieRuemmelecommented, Nov 1, 2022

Thank you @mrichbb - I have a fix ready for review 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generate sfdx-project.json - Salesforce Stack Exchange
My error is like : ERROR running force:package:version:create: The package MyPackageName isn't defined in the sfdx-project.json file. Add it ...
Read more >
Salesforce DX Project Configuration - Salesforce Developers
The project configuration file sfdx-project.json indicates that the directory is a Salesforce DX project. The configuration file contains project ...
Read more >
How I set up VSCode for a new Salesforce project - Katie Kodes
Folder creation; Folder tracking with Git; VSCode setup; First Git commit; SFDX configuration files; SFDX global authentication and aliasing ...
Read more >
Most Frequently used SFDX Commands – Home - Jitendra Zaa
Retrieve and Deploy code in Sandbox using SFDX – Old File Format ... In above command, –rootdir would be replaced by root path...
Read more >
Make the most of your DX projects with the built-in Node.js ...
The standard project template contains a package. json file which is a Node.js project descriptor that help you enhance your developer ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found