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

location is not defined #2536

Closed
drd0013 opened this issue Oct 25, 2023 · 4 comments
Closed

location is not defined #2536

drd0013 opened this issue Oct 25, 2023 · 4 comments
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated

Comments

@drd0013
Copy link

drd0013 commented Oct 25, 2023

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 doctor command 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

When attempting to run sf force apex test report -i <TEST_ID> the following error occurs:
Error (1): location is not defined

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 generate or fork dreamhouse-lwc.
  • Provide detailed step-by-step instructions on how to reproduce the issue.
  • Run an apex test job.
  • Grab the apex test job id
  • Run the above command with that id

Expected result

The test job information is retrieved

Actual result

This error is displayed.

System Information

Using zsh on mac

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.13.9",
  "nodeVersion": "node-v18.15.0",
  "osVersion": "Darwin 23.0.0",
  "rootPath": "/usr/local/lib/sf",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 2.3.9 (core)",
    "@oclif/plugin-commands 2.2.28 (core)",
    "@oclif/plugin-help 5.2.20 (core)",
    "@oclif/plugin-not-found 2.4.3 (core)",
    "@oclif/plugin-plugins 3.9.1 (core)",
    "@oclif/plugin-search 0.0.23 (core)",
    "@oclif/plugin-update 3.2.4 (core)",
    "@oclif/plugin-version 2.0.1 (core)",
    "@oclif/plugin-warn-if-update-available 2.1.1 (core)",
    "@oclif/plugin-which 2.2.34 (core)",
    "@salesforce/cli 2.13.9 (core)",
    "apex 2.3.19 (core)",
    "auth 2.8.20 (core)",
    "data 2.5.16 (core)",
    "deploy-retrieve 1.19.0 (core)",
    "info 2.6.49 (core)",
    "limits 2.3.38 (core)",
    "login 1.2.35 (core)",
    "marketplace 0.3.0 (core)",
    "org 2.10.12 (core)",
    "schema 2.3.29 (core)",
    "settings 1.4.33 (core)",
    "sobject 0.2.11 (core)",
    "source 2.10.40 (core)",
    "telemetry 2.3.6 (core)",
    "templates 55.5.14 (core)",
    "trust 2.6.18 (core)",
    "user 2.3.36 (core)"
  ]
}

Additional information

Full error message:

{
  "code": 1,
  "context": "Test",
  "commandName": "Test",
  "message": "location is not defined",
  "name": "ReferenceError",
  "status": 1,
  "stack": "ReferenceError: location is not defined\n    at Object.parse (/usr/local/lib/sf/node_modules/faye/src/util/uri.js:36:36)\n    at klass.initialize (/usr/local/lib/sf/node_modules/faye/src/protocol/dispatcher.js:21:28)\n    at new klass (/usr/local/lib/sf/node_modules/faye/src/util/class.js:13:28)\n    at Dispatcher.create (/usr/local/lib/sf/node_modules/faye/src/protocol/dispatcher.js:180:10)\n    at klass.initialize (/usr/local/lib/sf/node_modules/faye/src/protocol/client.js:43:35)\n    at new klass (/usr/local/lib/sf/node_modules/faye/src/util/class.js:13:28)\n    at new StreamingClient (/usr/local/lib/sf/node_modules/@salesforce/apex-node/lib/src/streaming/streamingClient.js:39:23)\n    at AsyncTests.<anonymous> (/usr/local/lib/sf/node_modules/@salesforce/apex-node/lib/src/tests/asyncTests.js:77:33)\n    at Generator.next (<anonymous>)\n    at /usr/local/lib/sf/node_modules/@salesforce/apex-node/lib/src/tests/asyncTests.js:14:71",
  "exitCode": 1,
  "warnings": []
}

I have tried reinstalling sfdx and rebooting my machine with no effect.

@drd0013 drd0013 added the investigating We're actively investigating this issue label Oct 25, 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 Oct 25, 2023
@cristiand391
Copy link
Member

@drd0013 are you able to repro the issue with a different org? can you get a sample repo to try replicate this locally?

@drd0013
Copy link
Author

drd0013 commented Oct 25, 2023

@cristiand391 I did not have an error with another org so removing and reauthenticating the org did fix it. Thanks for the tip!

@cristiand391
Copy link
Member

no problem!

from the error stacktrace I see this line caused the error:

uri.protocol = uri.protocol || location.protocol;

just guessing, but maybe it was trying to grab the instance URL from the auth file and failed.

I'll close this for now but someone gets this error on different orgs please open a new issue.

@cristiand391 cristiand391 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2023
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

2 participants