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 apex run: Nonexistent flag: --apex-code-file #1999

Closed
dschach opened this issue Mar 14, 2023 · 6 comments · Fixed by salesforcecli/plugin-apex#71
Closed

sf apex run: Nonexistent flag: --apex-code-file #1999

dschach opened this issue Mar 14, 2023 · 6 comments · Fixed by salesforcecli/plugin-apex#71
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue

Comments

@dschach
Copy link

dschach commented Mar 14, 2023

Summary

sf apex run --apex-code-file ./data/sample-data.apex --target-org MyOrg
Error (1): Nonexistent flag: --apex-code-file
See more help with --help

-f works. --apex-code-file does not.

Unable to run Apex using the code from the documentation

Steps To Reproduce:

  1. Create a scratch org where you know an Apex class can run
  2. Verify that sfdx force:apex:execute -f ./data/sample-data.apex works
  3. Verify that sf apex run -f ./data/sample-data.apex works
  4. Try with sf apex run --apex-code-file ./data/sample-data.apex
  5. See the error above

Expected result

Apex should execute, as the documentation says it would: https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_apex_commands_unified.htm#cli_reference_apex_run_unified

Actual result

Error as above

System Information

  • Which shell/terminal are you using? bash on OSX
{
  "cliVersion": "@salesforce/cli/1.68.2",
  "architecture": "darwin-arm64",
  "nodeVersion": "node-v18.14.1",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 2.1.3 (core)",
    "@oclif/plugin-commands 2.2.10 (core)",
    "@oclif/plugin-help 5.2.6 (core)",
    "@oclif/plugin-not-found 2.3.21 (core)",
    "@oclif/plugin-plugins 2.3.2 (core)",
    "@oclif/plugin-search 0.0.13 (core)",
    "@oclif/plugin-update 3.1.6 (core)",
    "@oclif/plugin-version 1.2.1 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.29 (core)",
    "@oclif/plugin-which 2.2.16 (core)",
    "apex 2.2.1 (core)",
    "auth 2.7.3 (core)",
    "data 2.3.4 (core)",
    "deploy-retrieve 1.8.2 (core)",
    "env 2.1.1 (core)",
    "functions 1.21.2 (core)",
    "info 2.4.7 (core)",
    "limits 2.3.5 (core)",
    "login 1.2.1 (core)",
    "org 2.4.4 (core)",
    "schema 2.3.2 (core)",
    "settings 1.4.1 (core)",
    "sobject 0.1.7 (core)",
    "telemetry 2.1.1 (core)",
    "templates 55.4.4 (core)",
    "trust 2.4.4 (core)",
    "user 2.3.2 (core)"
  ],
  "osVersion": "Darwin 22.3.0",
  "shell": "zsh",
  "rootPath": "/Users/<my_user>/.local/share/sfdx/client/7.191.1-3d81e83/sf"
}
@dschach dschach added the investigating We're actively investigating this issue label Mar 14, 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.

@AllanOricil
Copy link

AllanOricil commented Mar 15, 2023

@dschach
The right flag is --file or --apexcodefile (alias)

https://github.com/salesforcecli/plugin-apex/blob/main/src/commands/apex/run.ts

@iowillhoit
Copy link
Contributor

Thanks again @AllanOricil, that's correct! It does look like the examples are incorrect on this though, I will get a quick fix in. Thanks!

@iowillhoit iowillhoit added the bug Issue or pull request that identifies or fixes a bug label Mar 15, 2023
@git2gus
Copy link

git2gus bot commented Mar 15, 2023

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

@dschach
Copy link
Author

dschach commented Mar 15, 2023

Will the documentation I referenced be updated as well?

@iowillhoit
Copy link
Contributor

It will! I just got this fix merged in and we generate the website's Command Reference guide from the CLI itself. This change will be included in Thursday's latest-rc release of sfdx. Thanks again for reporting this @dschach

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

Successfully merging a pull request may close this issue.

3 participants