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

sf package installed list fails with TypeError: this.config.scopedEnvVarKeys is not a function #2330

Closed
gadamson-upco opened this issue Jul 28, 2023 · 7 comments
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated

Comments

@gadamson-upco
Copy link

gadamson-upco commented Jul 28, 2023

Summary

As of this morning ( ~11:00AM PDT), trying to run sf package installed list --json fails with an internal error,
TypeError: this.config.scopedEnvVarKeys is not a function. This occurs with multiple combinations of of os/arch.

Steps To Reproduce

  1. Install latest stable sf-cli, either via npm with npm install --global @salesforce/cli@latest or via tarball link from the sf cli documentation site
  2. Explicitly install packaging plugin via sf plugins install packaging
  3. Attempt to run sf package installed list --json

Expected result

Standard JSON output detailed installed packages in default project org

Actual result

Error: Command failed: sf package installed list --json

    at ChildProcess.exithandler (node:child_process:419:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'sf package installed list --json',
  stdout: '{\n' +
    '  "code": 1,\n' +
    '  "context": "PackageInstalledListCommand",\n' +
    '  "commandName": "PackageInstalledListCommand",\n' +
    '  "message": "this.config.scopedEnvVarKeys is not a function",\n' +
    '  "name": "TypeError",\n' +
    '  "status": 1,\n' +
    '  "stack": "TypeError: this.config.scopedEnvVarKeys is not a function\\n    at PackageInstalledListCommand._run (/home/circleci/.local/share/sf/node_modules/@oclif/core/lib/command.js:115:25)\\n    at PackageInstalledListCommand._run (/home/circleci/.local/share/sf/node_modules/@salesforce/sf-plugins-core/lib/sfCommand.js:227:22)\\n    at async Config.runCommand (/home/circleci/sfdx/node_modules/@oclif/core/lib/config/config.js:329:25)\\n    at async run (/home/circleci/sfdx/node_modules/@oclif/core/lib/main.js:89:16)",\n' +
    '  "exitCode": 1,\n' +
    '  "warnings": []\n' +
    '}\n',
  stderr: ''
}

Node.js v18.15.0

System Information

This occurs both on an Apple silicon Mac, and in a Linux CI environment

Mac details:

{
  "cliVersion": "@salesforce/cli/2.1.7",
  "architecture": "darwin-arm64",
  "nodeVersion": "node-v18.16.1",
  "osVersion": "Darwin 22.5.0",
  "shell": "bash",
  "rootPath": "/Users/gadamson/.nvm/versions/node/v18.16.1/lib/node_modules/@salesforce/cli",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 2.3.2 (core)",
    "@oclif/plugin-commands 2.2.18 (core)",
    "@oclif/plugin-help 5.2.13 (core)",
    "@oclif/plugin-not-found 2.3.31 (core)",
    "@oclif/plugin-plugins 3.1.6 (core)",
    "@oclif/plugin-search 0.0.20 (core)",
    "@oclif/plugin-update 3.1.26 (core)",
    "@oclif/plugin-version 1.3.7 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.43 (core)",
    "@oclif/plugin-which 2.2.25 (core)",
    "@salesforce/cli 2.1.7 (core)",
    "apex 2.3.6 (core)",
    "auth 2.8.9 (core)",
    "community 2.3.10 (user)",
    "data 2.5.1 (core)",
    "deploy-retrieve 1.16.0 (core)",
    "info 2.6.31 (core)",
    "limits 2.3.26 (core)",
    "login 1.2.20 (core)",
    "org 2.9.25 (core)",
    "packaging 1.21.4 (user)",
    "schema 2.3.20 (core)",
    "settings 1.4.20 (core)",
    "sobject 0.1.37 (core)",
    "source 2.10.25 (core)",
    "telemetry 2.2.3 (core)",
    "templates 55.5.5 (core)",
    "trust 2.4.32 (core)",
    "user 2.3.24 (core)"
  ]
}

Linux details (from CI so not a full verbose output):

@salesforce/cli/2.1.7 linux-x64 node-v18.15.0
community 2.3.10
packaging 1.21.4

Additional information

Interestingly, when I first tried to reproduce the issue locally on the mac, it ran without issue. This was with the same cli and packaging versions as the CI environment. I tried removing and reinstalling the plugins with the respective sf plugins commands without specifying a particular version. After reinstalling, I still had the same versions, but my local environment was now broken, failing with the same error. So it seems likely to be some downstream dependency change?

Downgrading packaging to 1.21.1 had no impact
Upgrading CLI to 2.2.7 had no impact

@gadamson-upco gadamson-upco added the investigating We're actively investigating this issue label Jul 28, 2023
@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.

@github-actions github-actions bot added the validated Version information for this issue has been validated label Jul 28, 2023
@iowillhoit
Copy link
Contributor

Thanks for the issue @gadamson-upco, we saw this same error in some of our integration tests and we are looking into it!

I will keep you posted

@jonnypetraglia
Copy link

Getting this on two separate commands: sf org login jwt and sf package version list --json.

We are even specifying exact versions of SF and plugins (to avoid this exact thing) and this error started failing in our CI/CD in between runs with no changes. It's a fresh Docker container with no prior state so this broke even with trying to maintain constant package versions....

CLI 1.85.8
Auth 2.7.17
Packaging 1.17.1

@iowillhoit
Copy link
Contributor

iowillhoit commented Jul 28, 2023

Ok we have a temporary fix while we look into this more.
User and Just In Time (JIT) plugins were pulling in a new version of oclif/core and causing a conflict.

If you uninstall your plugins and reinstall them, this should now work as expected.

List plugins
sf plugins list

Uninstall plugins
sf plugins uninstall packaging

@gadamson-upco
Copy link
Author

Looks to be working now. I also had the community plugin installed locally, until removed that plugin too and then reinstalled both the issue remained.

@jonnypetraglia
Copy link

That temporary fix worked for me too.

@iowillhoit
Copy link
Contributor

Yea, they likely would have deduped versions of oclif/core so they would have both need to be removed.

We just release a fix as @oclif/[email protected]! From what we can tell, it is working as expected. We will continue to keep an eye on it to be certain.

Appreciate all of your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

3 participants