Run apex test command giving strange error
Note Before you submit your issue, make sure that:
- You're using the latest version of Salesforce CLI.
- You've searched both open and closed issues for related posts.
- You've used the
doctorcommand to diagnose common issues.- You understand that GitHub Issues don't adhere to any agreement or SLA.
- If you require immediate assistance, use official channels such as Salesforce Customer Support.
Summary
Steps To Reproduce
IMPORTANT Provide a repository that's configured to reproduce the issue. If you are unable to provide a repo, please explain why not. The more info we have from the start, the faster we can resolve your issue. We may close your issue if you don't include proper instructions.
- Generate a project with
sf project generateor fork dreamhouse-lwc.- Provide detailed step-by-step instructions on how to reproduce the issue.
Command run:
sf apex test run -c -r json -o
Expected result
Run specified tests on org
Actual result
Error:
(node:867804) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
17:07:10 (Use node --trace-deprecation ... to show where the warning was created)
17:07:13 The environment variable HTTPS_PROXY is discouraged. Use https_proxy.
17:07:13 The environment variable HTTPS_PROXY is discouraged. Use https_proxy.
17:07:14 file:///apps/external/4/downloaded_tools/.nvm/versions/node/v21.7.3/lib/node_modules/@salesforce/cli/node_modules/@salesforce/plugin-apex/lib/commands/apex/run/test.js:102
17:07:14 throw messages.createError('apexLibErr', [err.message]);
17:07:14 ^
17:07:14
17:07:14 SfError [ApexLibErrError]: Unknown error in Apex Library: Test run handshake failed: 403::Handshake denied
17:07:14 at Messages.createError (/apps/external/4/downloaded_tools/.nvm/versions/node/v21.7.3/lib/node_modules/@salesforce/cli/node_modules/@salesforce/core/lib/messages.js:444:16)
17:07:14 at process.
System Information
kshSFDX & Node Version :: {
"architecture": "linux-x64",
"cliVersion": "@salesforce/cli/2.39.6",
"nodeVersion": "node-v21.7.3",
"osVersion": "Linux 4.18.0-513.24.1.el8_9.x86_64",
"rootPath": /apps/external/4/downloaded_tools/.nvm/versions/node/v21.7.3/lib/node_modules/@salesforce/cli,
"shell": "ksh",
"pluginVersions": [
"@oclif/plugin-autocomplete 3.0.16 (core)",
"@oclif/plugin-commands 3.3.1 (core)",
"@oclif/plugin-help 6.0.21 (core)",
"@oclif/plugin-not-found 3.1.6 (core)",
"@oclif/plugin-plugins 5.0.14 (core)",
"@oclif/plugin-search 1.0.23 (core)",
"@oclif/plugin-update 4.2.7 (core)",
"@oclif/plugin-version 2.0.17 (core)",
"@oclif/plugin-warn-if-update-available 3.0.15 (core)",
"@oclif/plugin-which 3.1.8 (core)",
"@salesforce/cli 2.39.6 (core)",
"apex 3.1.9 (core)",
"auth 3.6.3 (core)",
"data 3.3.2 (core)",
"deploy-retrieve 3.6.6 (core)",
"info 3.2.3 (core)",
"limits 3.3.4 (core)",
"marketplace 1.2.4 (core)",
"org 4.1.3 (core)",
"packaging 2.4.0 (core)",
"schema 3.3.4 (core)",
"settings 2.2.1 (core)",
"sobject 1.3.6 (core)",
"source 3.3.3 (core)",
"telemetry 3.3.4 (core)",
"templates 56.2.4 (core)",
"trust 3.6.6 (core)",
"user 3.5.2 (core)"
]
}
PASTE_VERSION_OUTPUT_HERE
Additional information
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.
@Tanvidh Can you provide more details on how to reproduce this error? The command you provided (sf apex test run -c -r json -o -w 180 -l RunSpecifiedTests -t "" -d test-result --json) isn't valid for two reasons:
- the
-oflag expects a value - the
-tflag must be valid names of ids of the test classes
Hi @mdonnalley Running any type of run apex test command is giving this error whether it's Run Local tests or Run specified test
Are you using a proxy?
17:07:13 The environment variable HTTPS_PROXY is discouraged. Use https_proxy.
17:07:13 The environment variable HTTPS_PROXY is discouraged. Use https_proxy.
If so, that's probably the reason why you're getting this 403:
17:07:14 SfError [ApexLibErrError]: Unknown error in Apex Library: Test run handshake failed: 403::Handshake denied
This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.