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 org login sfdx-url --sfdx-url-stdin` fails if an extra flag is given #2811

Closed
k-capehart opened this issue Apr 8, 2024 · 3 comments · Fixed by oclif/core#1046 or oclif/core#1047
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated

Comments

@k-capehart
Copy link

k-capehart commented Apr 8, 2024

Summary

sf org login sfdx-url --sfdx-url-stdin requires either no input or -. However, when no input is given, and a second flag is used, then the cli is reading the second flag as the input for --sfdx-url-stdin, resulting in an error message. This appears to be an issue with oclif.

I've created a PR to fix this, linked below.

Also, there is a small issue with documentation that I've listed at the bottom.

Steps To Reproduce

Happy path:
$ echo {SFDX AUTH URL} | sf org login sfdx-url --set-default --sfdx-url-stdin
This results in successful authentication. Note that --sfdx-url-stdin is given as the last flag.

Bad path:
$ echo {SFDX AUTH URL} | sf org login sfdx-url --sfdx-url-stdin --set-default
This results in the following error:
Error (1): Flag --sfdx-url-stdin can only be read from stdin. The value must be "-" or not provided at all.
Note that --sfdx-url-stdin is given before --set-default.

Expected result

The command should succeed regardless of the order that the flags are given.

Actual result

The command fails unless --sfdx-url-stdin is given last in a sequence of flags.

System Information

shell: zsh

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.35.6",
  "nodeVersion": "node-v21.7.1",
  "osVersion": "Darwin 22.3.0",
  "rootPath": "/opt/homebrew/lib/node_modules/@salesforce/cli",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.13 (core)",
    "@oclif/plugin-commands 3.2.2 (core)",
    "@oclif/plugin-help 6.0.20 (core)",
    "@oclif/plugin-not-found 3.1.1 (core)",
    "@oclif/plugin-plugins 5.0.1 (core)",
    "@oclif/plugin-search 1.0.20 (core)",
    "@oclif/plugin-update 4.2.2 (core)",
    "@oclif/plugin-version 2.0.16 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.15 (core)",
    "@oclif/plugin-which 3.1.7 (core)",
    "@salesforce/cli 2.35.6 (core)",
    "apex 3.1.0 (core)",
    "auth 3.5.0 (core)",
    "custom-metadata 3.1.18 (user)",
    "data 3.2.2 (core)",
    "deploy-retrieve 3.4.0 (core)",
    "info 3.1.0 (core)",
    "limits 3.2.0 (core)",
    "marketplace 1.1.0 (core)",
    "org 3.6.0 (core)",
    "packaging 2.2.0 (core)",
    "schema 3.2.0 (core)",
    "settings 2.1.0 (core)",
    "signups 2.0.29 (user)",
    "sobject 1.2.0 (core)",
    "source 3.2.0 (core)",
    "telemetry 3.1.17 (core)",
    "templates 56.1.0 (core)",
    "trust 3.4.0 (core)",
    "user 3.4.0 (core)"
  ]
}

Additional information

There is also a small issue with documentation for this flag. This is how it appears in the developer docs:

image

Formatting seems a little weird since usually you would expect all examples to be prefixed with sf, but this one uses echo first.

@k-capehart k-capehart added the investigating We're actively investigating this issue label Apr 8, 2024
Copy link

github-actions bot commented Apr 8, 2024

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.

@jshackell-sfdc
Copy link
Collaborator

@k-capehart -- thanks for pointing out the weird doc formatting problem. It should be fixed in next week's developer.salesforce.com doc release.

@k-capehart
Copy link
Author

@jshackell-sfdc Thank you for getting it fixed!

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
2 participants