Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

force:package:beta:version:create error "Cannot read properties of undefined (reading 'package')" #1750

Closed
6ithu8u53r opened this issue Oct 12, 2022 · 10 comments
Assignees
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue

Comments

@6ithu8u53r
Copy link

Summary

Running sfdx force:package:beta:version:create command fails: Cannot read properties of undefined (reading 'package')

Running sfdx force:package:version:create command works with 7.170.0 or earlier releases. I'm attempting to use the beta command because issues starting with 7.171.0 appear to be related to issue 1742.

Steps To Reproduce:

I've opened a case regarding this advised to add an issue here and link the case to it. The case contains the failing DX Project code.

Expected result

Expected the package version to be created successfully.

Actual result

Command fails...

{
  "status": 1,
  "name": "Type",
  "message": "Cannot read properties of undefined (reading 'package')",
  "exitCode": 1,
  "context": "PackageVersionCreateCommand",
  "stack": "Type: Cannot read properties of undefined (reading 'package')\n    at Function.wrap (C:\\Users\\MyUser\\AppData\\Local\\sfdx\\client\\7.171.0-fbe9e7d\\node_modules\\@salesforce\\core\\lib\\sfError.js:61:25)\n    at PackageVersionCreateCommand.catch (C:\\Users\\MyUser\\AppData\\Local\\sfdx\\client\\7.171.0-fbe9e7d\\node_modules\\@salesforce\\command\\lib\\sfdxCommand.js:283:38)\n    at async PackageVersionCreateCommand._run (C:\\Users\\MyUser\\AppData\\Local\\sfdx\\client\\7.171.0-fbe9e7d\\node_modules\\@salesforce\\command\\lib\\sfdxCommand.js:106:13)\n    at async Config.runCommand (C:\\Users\\MyUser\\AppData\\Local\\sfdx\\client\\7.171.0-fbe9e7d\\node_modules\\@oclif\\core\\lib\\config\\config.js:272:25)\n    at async run (C:\\Users\\MyUser\\AppData\\Local\\sfdx\\client\\7.171.0-fbe9e7d\\node_modules\\@oclif\\core\\lib\\main.js:76:5)\nCaused by: Type: Cannot read properties of undefined (reading 'package')\n    at PackageVersionCreateCommand.run (C:\\Users\\MyUser\\AppData\\Local\\sfdx\\client\\7.171.0-fbe9e7d\\node_modules\\@salesforce\\plugin-packaging\\lib\\commands\\force\\package\\beta\\version\\create.js:48:75)\n    at PackageVersionCreateCommand._run (C:\\Users\\MyUser\\AppData\\Local\\sfdx\\client\\7.171.0-fbe9e7d\\node_modules\\@salesforce\\command\\lib\\sfdxCommand.js:102:51)\n    at async Config.runCommand (C:\\Users\\MyUser\\AppData\\Local\\sfdx\\client\\7.171.0-fbe9e7d\\node_modules\\@oclif\\core\\lib\\config\\config.js:272:25)\n    at async run (C:\\Users\\MyUser\\AppData\\Local\\sfdx\\client\\7.171.0-fbe9e7d\\node_modules\\@oclif\\core\\lib\\main.js:76:5)",
  "warnings": [],
  "commandName": "PackageVersionCreateCommand"
}

System Information

  • Which shell/terminal are you using? cmd.exe
sfdx version --verbose --json
{
  "cliVersion": "sfdx-cli/7.171.0",
  "architecture": "win32-x64",
  "nodeVersion": "node-v16.17.0",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 1.3.0 (core)",
    "@oclif/plugin-commands 2.2.0 (core)",
    "@oclif/plugin-help 5.1.12 (core)",
    "@oclif/plugin-not-found 2.3.1 (core)",
    "@oclif/plugin-plugins 2.1.0 (core)",
    "@oclif/plugin-update 3.0.0 (core)",
    "@oclif/plugin-version 1.1.2 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.4 (core)",
    "@oclif/plugin-which 2.1.0 (core)",
    "alias 2.1.3 (core)",
    "apex 1.1.0 (user)",
    "auth 2.2.10 (core)",
    "community 2.0.3 (core)",
    "config 1.4.21 (core)",
    "custom-metadata 1.0.12 (user)",
    "data 2.0.4 (user)",
    "generator 2.0.2 (core)",
    "info 2.1.6 (core)",
    "limits 2.0.1 (user)",
    "org 2.0.5 (user)",
    "packaging 1.9.2 (core)",
    "schema 2.1.1 (user)",
    "signups 1.2.4 (core)",
    "source 2.0.16 (core)",
    "telemetry 2.0.2 (core)",
    "templates 51.5.0 (user)",
    "trust 2.0.4 (core)",
    "user 2.1.0 (user)",
    "@salesforce/sfdx-plugin-lwc-test 1.0.0 (user)",
    "salesforce-alm 52.0.0 (user)",
    "salesforcedx 52.0.0 (user)",
    "sfdx-codescan-plugin 1.0.7 (user)",
    "texei-sfdx-plugin 1.17.0 (user)"
  ],
  "osVersion": "Windows_NT 10.0.19044",
  "shell": "cmd.exe",
  "rootPath": "C:\\Users\\MyUser\\AppData\\Local\\sfdx\\client\\7.171.0-fbe9e7d"
}

Additional information

@6ithu8u53r 6ithu8u53r added the investigating We're actively investigating this issue label Oct 12, 2022
@github-actions
Copy link

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.

@peternhale peternhale added the bug Issue or pull request that identifies or fixes a bug label Oct 13, 2022
@git2gus
Copy link

git2gus bot commented Oct 13, 2022

This issue has been linked to a new work item: W-11903179

@peternhale
Copy link
Contributor

@6ithu8u53r Thanks for the report. We really appreciate you giving the beta commands a spin.

Is there a particular path you took to get to this issue? Is there a dx packaging project that can be used to reproduce this issue?

@peternhale peternhale self-assigned this Oct 13, 2022
@6ithu8u53r
Copy link
Author

6ithu8u53r commented Oct 13, 2022

This was a DX package that's been in use for about a year now. The package version create failed using the 7.171.0 cli release so we were advised to try the beta version. The beta version failed with the error in this issue, which was different than our original error. Unfortunately I do not have a project that I can share publicly to reproduce the issue, but it is attached to the case that I opened with Salesforce.

@peternhale
Copy link
Contributor

Ok, thanks for the info. I found the root cause and I am working on a fix now.

The reproduction scenario I used was running version create using the --path <dirname> where the directory exists, but no entry found in dx project json using the value from the --path flag.

Does this track with your attempt?

@6ithu8u53r
Copy link
Author

I don't think so the path value in the json matches what is on the command line.

Here's what my command looks like...
sfdx force:package:beta:version:create --json -c -v [email protected] -x -b refs/pull/46/merge -d folder_a/folder_b -f ./config/project-scratch-def.json -t Tag__20221008.7a -w 90

and here's the sfdx-prject.json section with the path...

{
    "packageDirectories": [
        {
            "path": "folder_a/folder_b",
            "default": true,

@ChloeCoon
Copy link

Seeing this same error as well.

create command:

sfdx force:package:beta:version:create -x -d "src/gradient-works" -f "config/dev-scratch-def.json" --codecoverage --json

sfdx-project.json packageDirectories section:

"packageDirectories": [
        {
            "path": "src/gradient-works",
            "package": "Gradient Works",
            "versionNumber": "1.70.0.NEXT",
            "default": false,
            "postInstallScript": "PostInstall",
            "ancestorId": "04t4z000000A65EAAS"
        },
        {
            "path": "src/post-install",
            "default": false
        },
        {
            "path": "src/unpackaged",
            "default": true
        }
    ],

version info:

❯ sfdx version --verbose --json
{
  "cliVersion": "sfdx-cli/7.171.0",
  "architecture": "darwin-x64",
  "nodeVersion": "node-v16.17.0",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 1.3.0 (core)",
    "@oclif/plugin-commands 2.2.0 (core)",
    "@oclif/plugin-help 5.1.12 (core)",
    "@oclif/plugin-not-found 2.3.1 (core)",
    "@oclif/plugin-plugins 2.1.0 (core)",
    "@oclif/plugin-update 3.0.0 (core)",
    "@oclif/plugin-version 1.1.2 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.4 (core)",
    "@oclif/plugin-which 2.1.0 (core)",
    "alias 2.1.3 (core)",
    "apex 1.2.0 (core)",
    "auth 2.2.10 (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.2 (core)",
    "info 2.1.6 (core)",
    "limits 2.0.3 (core)",
    "org 2.2.7 (core)",
    "packaging 1.9.2 (core)",
    "schema 2.1.8 (core)",
    "signups 1.2.4 (core)",
    "source 2.0.16 (core)",
    "telemetry 2.0.2 (core)",
    "templates 55.1.0 (core)",
    "trust 2.0.4 (core)",
    "user 2.1.7 (core)",
    "@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)",
    "salesforce-alm 54.8.1 (core)"
  ],
  "osVersion": "Darwin 21.6.0",
  "shell": "zsh",
  "rootPath": "/Users/chloecoon/.local/share/sfdx/client/7.171.0-fbe9e7d"
}

@johnforeland
Copy link

Add versionName to sfdx-project.json, and the error should go away. Not a full fix, but temporary. And might help the DX team in investigating why the issue occurs.

@6ithu8u53r
Copy link
Author

Add versionName to sfdx-project.json, and the error should go away. Not a full fix, but temporary. And might help the DX team in investigating why the issue occurs.

Thanks for the suggestion, but versionName already exists in sfdx-project.json

@6ithu8u53r
Copy link
Author

This has been added to the list of Known Issues that is in review at the time of this post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue
Projects
None yet
Development

No branches or pull requests

5 participants