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

Orgs implementing MyDomain need re-authorization or will receive misleading error. #1732

Closed
svallejo opened this issue Sep 30, 2022 · 1 comment · Fixed by forcedotcom/sfdx-core#667
Labels
investigating We're actively investigating this issue

Comments

@svallejo
Copy link

Summary
Unable to perform sfdx force:source commands, error is “ERROR running force:source:legacy:status: Cannot read properties of undefined (reading 'length')”
Steps To Reproduce:
sfdx force:source:legacy:status -u or
sfdx force:source:legacy:pull -u
Expected result
Command should work as it always has.
Actual result
$ sfdx force:source:legacy:status -u
WARNING: The command "SourceStatusCommand" has been deprecated and will be removed in v56.0 or later. Use "force:source:status" instead.
ERROR running force:source:legacy:status: Cannot read properties of undefined (reading 'length')
Additional information
Feel free to attach a screenshot.
SFDX CLI Version(to find the version of the CLI engine run sfdx --version):
sfdx-cli/7.169.1 darwin-x64 node-v16.17.0
SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)
@oclif/plugin-autocomplete 1.3.0 (core)
@oclif/plugin-commands 2.2.0 (core)
@oclif/plugin-help 5.1.12 (core)
@oclif/plugin-not-found 2.3.1 (core)
@oclif/plugin-plugins 2.1.0 (core)
@oclif/plugin-update 3.0.0 (core)
@oclif/plugin-version 1.1.2 (core)
@oclif/plugin-warn-if-update-available 2.0.4 (core)
@oclif/plugin-which 2.1.0 (core)
@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)
alias 2.1.0 (core)
apex 1.2.0 (core)
auth 2.2.5 (core)
community 2.0.1 (core)
config 1.4.19 (core)
custom-metadata 2.0.0 (core)
data 2.1.2 (core)
generator 2.0.2 (core)
info 2.1.0 (core)
limits 2.0.1 (core)
org 2.2.3 (core)
packaging 1.9.1 (core)
salesforce-alm 54.8.1 (core)
schema 2.1.3 (core)
sfdx-cli 7.169.1 (core)
signups 1.2.0 (core)
source 2.0.13 (core)
telemetry 2.0.0 (core)
templates 55.1.0 (core)
trust 2.0.4 (core)
user 2.1.2 (core)
OS and version:
MacOS 12.6
Stack Trace:

ERROR running force:source:legacy:status: Cannot read properties of undefined (reading 'length')
*** Internal Diagnostic ***
Type: Cannot read properties of undefined (reading 'length')
at Function.wrap (/usr/local/lib/sfdx/node_modules/@salesforce/core/lib/sfError.js:61:25)
at SourceStatusCommand.catch (/usr/local/lib/sfdx/node_modules/salesforce-alm/dist/ToolbeltCommand.js:255:44)
at async SourceStatusCommand._run (/usr/local/lib/sfdx/node_modules/@salesforce/command/lib/sfdxCommand.js:106:13)
at async Config.runCommand (/usr/local/lib/sfdx/node_modules/@oclif/core/lib/config/config.js:272:25)
at async run (/usr/local/lib/sfdx/node_modules/@oclif/core/lib/main.js:76:5)
Caused by: TypeError: Cannot read properties of undefined (reading 'length')
at Query._execute (/usr/local/lib/sfdx/node_modules/jsforce/lib/query.js:483:205)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /usr/local/lib/sfdx/node_modules/jsforce/lib/query.js:395:9


Log:
{"name":"sf","hostname":"HONC02DR86LMD6R","pid":10663,"log":"SourceStatusCommand","level":40,"msg":"[\n '\x1B[33mWARNING:\x1B[39m',\n 'The command "SourceStatusCommand" has been deprecated and will be removed in v56.0 or later. Use "force:source:status" instead.'\n]","time":"2022-09-26T14:16:23.211Z","v":0}
{"name":"sf","hostname":"HONC02DR86LMD6R","pid":10663,"log":"SourceStatusCommand","level":50,"msg":"[\n '\x1B[1mERROR running force:source:legacy:status: \x1B[22m',\n "\x1B[31mCannot
read properties of undefined (reading 'length')\x1B[39m"\n]","time":"2022-09-26T14:16:30.304Z","v":0}

ROOT Cause :

On investigation, this was an issue with the implementation of mydomain on a previously onauthorized org. As per query.js :

this.records = (_this$records2 = this.records) === null || _this$records2 === void 0 ? void 0 : (0, _concat.default)(_this$records2).call(_this$records2, maxFetch - this.records.length > data.records.length ? data.records : (0, _slice.default)(_context7 = data.records).call(_context7, 0, maxFetch - this.records.length));
this._locator = data.nextRecordsUrl ? this.urlToLocator(data.nextRecordsUrl) : undefined;
this._finished = this._finished || data.done || !autoFetch || // this is what the response looks like when there are no results
data.records.length === 0 && data.done === undefined; // streaming record instances

This does not appear to make account for API calls that result in 200 level status not conforming to the expected response shape, which would be the case here. force:org:open in these instances redirects to an authorization page.

Re-authorization of the org fixes this error, so this issue is more for general information for future googlers .

@svallejo svallejo added the investigating We're actively investigating this issue label Sep 30, 2022
@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.

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant