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
474 stars 77 forks source link

sf org login jwt -> TypeError: #2935

Open tparaiso opened 2 weeks ago

tparaiso commented 2 weeks ago

Summary

When the commande "sf org login jwt" is executed, it returns "TypeError: Cannot read properties of undefined (reading 'entries')"

Steps To Reproduce:

  1. This is step 1 -> In terminal type : sf org login jwt .

Expected result

You forget something normally

Actual result

TypeError: Cannot read properties of undefined (reading 'entries')

Additional information

Feel free to attach a screenshot.

Salesforce Extension Version in VS Code:

Salesforce CLI Version: Latest @salesforce/cli/2.46.6 darwin-arm64 node-v20.9.0

OS and version: MacOs Sonoma

CleanShot 2024-06-21 at 10 22 34

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

github-actions[bot] commented 2 weeks ago

Hello @tparaiso :wave: It looks like you didn't include the full Salesforce CLI version information in your issue. Please provide the output of version --verbose --json for the CLI you're using (sf or sfdx).

A few more things to check:

Thank you!

tparaiso commented 2 weeks ago

{ "architecture": "darwin-arm64", "cliVersion": "@salesforce/cli/2.46.6", "nodeVersion": "node-v20.9.0", "osVersion": "Darwin 23.5.0", "rootPath": "/usr/local/lib/node_modules/@salesforce/cli", "shell": "zsh", "pluginVersions": [ "@oclif/plugin-autocomplete 3.1.2 (core)", "@oclif/plugin-commands 4.0.2 (core)", "@oclif/plugin-help 6.2.1 (core)", "@oclif/plugin-not-found 3.2.3 (core)", "@oclif/plugin-plugins 5.2.4 (core)", "@oclif/plugin-search 1.1.2 (core)", "@oclif/plugin-update 4.3.5 (core)", "@oclif/plugin-version 2.2.3 (core)", "@oclif/plugin-warn-if-update-available 3.1.5 (core)", "@oclif/plugin-which 3.2.2 (core)", "@salesforce/cli 2.46.6 (core)", "apex 3.1.18 (core)", "auth 3.6.21 (core)", "community 3.0.13 (user) published 159 days ago (Sat Jan 13 2024) (latest is 3.2.20)", "data 3.4.6 (core)", "deploy-retrieve 3.9.4 (core)", "info 3.3.6 (core)", "limits 3.3.12 (core)", "marketplace 1.2.12 (core)", "org 4.2.1 (core)", "packaging 2.1.1 (user) published 158 days ago (Sun Jan 14 2024) (latest is 2.6.1)", "schema 3.3.11 (core)", "settings 2.3.1 (core)", "signups 2.0.17 (user) published 158 days ago (Sun Jan 14 2024) (latest is 2.3.13)", "sobject 1.4.11 (core)", "source 3.4.2 (core)", "telemetry 3.4.0 (core)", "templates 56.2.11 (core)", "trust 3.7.5 (core)", "user 3.5.13 (core)", "edenred-sfdx-plugin 2.0.0 (link) /Users/Thomas/developpement/programmes/edenred/Redforce/edenred-sfdx-plugin" ] }

tparaiso commented 2 weeks ago

Same issue with this command : sf org list

TypeError: Cannot read properties of undefined (reading 'entries')

shetzel commented 1 week ago

@tparaiso - I can't reproduce this using the same installed CLI version. We have tons of tests that use these commands as well and they run cleanly. This is specific to your environment so here's what I'd do:

  1. Use the sf plugins reset command to put your CLI back to a base state. The --hard flag might be a good idea to use as well.
  2. After a reset, try sf org list again. If it works without error, then one of the old plugins installed is likely causing the issue. Figure out which one and pinpoint the problem. I would use the CLI-bundled versions of the core plugins. If it's the linked plugin, get more details about it (i.e., a stack trace) with export SF_ENV=development and rerun the command.
  3. If the error still happens after a reset, then please provide more information by running sf doctor --command "org list" and inspecting the results. I would like to see the stack trace from the debug output files.
tparaiso commented 1 week ago

@shetzel thank you very much, the command "sf plugins reset --hard" fix my issue.

At my work I have had the same issue with our CI, we installed the previous version of the CLI and it's worked. There is something in the version of June 20 and plugins dependency. I will try the command tomorrow.

Thanks !

seanhharrison commented 1 week ago

I had the same problem. FWIW, I uninstalled plug-ins one at a time until sf org list worked again. Started working again after uninstalling @salesforce/sfdx-scanner 3.11.0

mgalalm commented 1 week ago

We're experiencing the same error with this version as well

jhgihub0 commented 1 week ago

@salesforce/cli/2.47.6 darwin-x64 node-v20.10.0 still has the issue

mgalalm commented 1 week ago

It appears that a breakage has been introduced for plugins using the relatively old sfdx-core package, as noted in this pull request: https://github.com/forcedotcom/sfdx-core/pull/1080. I managed to bypass the problem for debugging purposes by editing the core library. Specifically, I added a couple of lines

exports.Lifecycle = Lifecycle;
Lifecycle.getInstance()

above

const cloneListeners = (listeners) => new Map(Array.from(listeners.entries()));

in the lifecycleEvents.js part of the old version of the sfdx-core package. Please note that I am not proposing this as a solution, just sharing my findings.

WillieRuemmele commented 1 week ago

Thanks @mgalalm @jhgihub0 @seanhharrison - I verified that the bug exists with @salesforce/sfdx-scanner@3.11.0 - I just tried installing the latest version of scanner (4.3.0) and it worked.

if anyone else can confirm the latest version of scanner is fixed as well that'd be great

four4444PL commented 4 days ago

Unfortunately Im getting the same problem there :( Updating the scanner to version 4.3.0 havent helped :( Any other recomendations? My config looks as below: { "architecture": "win32-x64", "cliVersion": "@salesforce/cli/2.47.6", "nodeVersion": "node-v20.14.0", "osVersion": "Windows_NT 10.0.22631", "rootPath": "C:\Users\Lenovo\AppData\Local\sf\client\2.47.6-6b39a27", "shell": "cmd.exe", "pluginVersions": [ "@oclif/plugin-autocomplete 3.1.4 (core)", "@oclif/plugin-commands 4.0.4 (core)", "@oclif/plugin-help 6.2.3 (core)", "@oclif/plugin-not-found 3.2.5 (core)", "@oclif/plugin-plugins 5.3.2 (core)", "@oclif/plugin-search 1.1.4 (core)", "@oclif/plugin-update 4.4.2 (core)", "@oclif/plugin-version 2.2.4 (core)", "@oclif/plugin-warn-if-update-available 3.1.6 (core)", "@oclif/plugin-which 3.2.4 (core)", "@salesforce/cli 2.47.6 (core)", "apex 3.1.21 (core)", "auth 3.6.23 (core)", "custom-metadata 3.3.13 (user)", "data 3.5.0 (core)", "deploy-retrieve 3.9.6 (core)", "info 3.3.9 (core)", "limits 3.3.13 (core)", "marketplace 1.2.15 (core)", "org 4.2.4 (core)", "packaging 2.4.6 (core)", "schema 3.3.14 (core)", "settings 2.3.3 (core)", "sobject 1.4.12 (core)", "source 3.4.6 (core)", "telemetry 3.4.3 (core)", "templates 56.2.13 (core)", "trust 3.7.7 (core)", "user 3.5.15 (core)", "@salesforce/sfdx-scanner 4.3.0 (user)", "sfdx-git-delta 5.40.2 (user)", "sfdx-git-packager 0.3.4 (user)", "sfdx-mdt-plugin 0.6.6 (user)", "sfdx-plugin-source-read 1.2.0 (user)" ] }

kevanmoothien commented 3 days ago

Upgrading to latest version of sfdx/scanner is not working on my side.

ReaperBeats commented 3 days ago

Same happens to me. Tried reinstalling or uninstalling the sacnner, but it doesnt work. Also for me its just happening when I try to deploy or retrieve using the VSCode UI, but it does not happen if I exceute sf project deploy start -d "..." directly in the terminal. I tried reinstalling the VSCode plugins, but that did not work also

tparaiso commented 3 days ago

If you are blocked, you can install an older version (that's worked for me on my other computer) : install @salesforce/cli@2.45.6 --global (https://help.salesforce.com/s/articleView?id=release-notes.rn_sf_cli_previous_version.htm&release=220&type=5)

WillieRuemmele commented 3 days ago

Hey @tparaiso @ReaperBeats @kevanmoothien @four4444PL - after a lot more testing, I'm still stumped. I've installed all of the versions, with the various node versions reported, and the problem keeps appearing for me when I use scanner@3.11.0, once I bump that to the latest ^4 version, it goes away

git2gus[bot] commented 2 days ago

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