Skip to content

fix: defend against bad mdapi responses #1236

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

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

mshanemc
Copy link
Contributor

@mshanemc mshanemc commented Feb 9, 2024

What does this PR do?

handles undefined being passsed to a method that expects strings. It'd be better if all the consumers of this warned which component was missing its filename in the MDAPI reponse, but this at least prevents the unhelpful error.

How'd this get by us? The mdapi response isn't matching its expected typing. I'm guessing that's a server bug related to the new release, but am waiting for the full deployResult so I can inspect its contents. One of the DeployMessage is unexpectedly missing the fileName property.

ex: forcedotcom/cli#2697
also got a report of this happening on push

  "code": 10.0,
  "context": "Push",
  "commandName": "Push",
  "message": "Cannot read properties of undefined (reading \u0027split\u0027)",
  "name": "TypeError",
  "status": 10.0,
  "stack": "TypeError: Cannot read properties of undefined (reading \u0027split\u0027)\n    at sf\\client\\2.27.6-2617cbc\\node_modules\\@salesforce\\source-deploy-retrieve\\lib\\src\\resolve\\treeContainers.js:183:37\n    at Array.map (\u003canonymous\u003e)\n    at VirtualTreeContainer.fromFilePaths (sf\\client\\2.27.6-2617cbc\\node_modules\\@salesforce\\source-deploy-retrieve\\lib\\src\\resolve\\treeContainers.js:182:15)\n    at PushResultFormatter.componentsFromFilenames (/sf/client/2.27.6-2617cbc/node_modules/@salesforce/plugin-source/lib/formatters/source/pushResultFormatter.js:207:79)\n    at PushResultFormatter.correctFileResponses (/sf/client/2.27.6-2617cbc/node_modules/@salesforce/plugin-source/lib/formatters/source/pushResultFormatter.js:102:57)\n    at new PushResultFormatter (/sf/client/2.27.6-2617cbc/node_modules/@salesforce/plugin-source/lib/formatters/source/pushResultFormatter.js:27:35)\n    at Push.formatResult (/sf/client/2.27.6-2617cbc/node_modules/@salesforce/plugin-source/lib/commands/force/source/push.js:199:27)\n    at Push.run (/sf/client/2.27.6-2617cbc/node_modules/@salesforce/plugin-source/lib/commands/force/source/push.js:67:21)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Push._run (sf\\client\\2.27.6-2617cbc\\node_modules\\@oclif\\core\\lib\\command.js:304:22)",
  "exitCode": 10.0,
  "warnings": [
    "We plan to deprecate this command in the future. Try using the \"project deploy start\" command instead.",
    "The \"-u\" flag has been deprecated. Use \"--target-org | -o\" instead.",
    "Network error occurred.  Continuing to poll."
  ]
}

What issues does this PR fix or reference?

#, @@

Functionality Before

<insert gif and/or summary>

Functionality After

<insert gif and/or summary>

@mshanemc mshanemc requested a review from a team as a code owner February 9, 2024 14:24
@mshanemc mshanemc merged commit d35911d into main Feb 9, 2024
@mshanemc mshanemc deleted the sm/missing-filenams-on-mdapi-responses branch February 9, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants