forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
494 stars 78 forks source link

`--line-ending` does not seem to do anything #3113

Closed OscarTheGrinch closed 2 hours ago

OscarTheGrinch commented 2 hours ago

Version information

PS C:\Projects\DigitalCore> sf version --verbose --json
{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.65.8",
  "nodeVersion": "node-v20.8.1",
  "osVersion": "Windows_NT 10.0.19045",
  "rootPath": "C:\\Users\\JanvadH\\AppData\\Roaming\\npm\\node_modules\\@salesforce\\cli",
  "shell": "powershell",
  "pluginVersions": [
    "@dxatscale/sfpowerscripts 25.5.3 (user) published 356 days ago (Fri Nov 24 2023)",
    "@jayree/sfdx-plugin-org 1.2.56 (user) published 145 days ago (Sun Jun 23 2024) (latest is 1.2.81)",
    "@oclif/plugin-autocomplete 3.2.7 (core)",
    "@oclif/plugin-commands 3.3.4 (user) published 188 days ago (Sat May 11 2024) (latest is 4.1.8)",
    "@oclif/plugin-help 5.2.17 (user) published 461 days ago (Sat Aug 12 2023) (latest is 6.2.16)",
    "@oclif/plugin-not-found 3.2.24 (core)",
    "@oclif/plugin-plugins 5.4.15 (core)",
    "@oclif/plugin-search 1.2.13 (core)",
    "@oclif/plugin-update 4.6.8 (core)",
    "@oclif/plugin-version 2.2.15 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.20 (core)",
    "@oclif/plugin-which 3.2.16 (core)",
    "@salesforce/cli 2.65.8 (core)",
    "apex 3.5.5 (core)",
    "api 1.3.1 (core)",
    "auth 3.6.70 (core)",
    "data 3.9.0 (core)",
    "deploy-retrieve 3.15.4 (core)",
    "info 3.4.15 (core)",
    "limits 3.3.37 (core)",
    "marketplace 1.3.2 (core)",
    "org 5.0.2 (core)",
    "packaging 2.4.6 (user) published 161 days ago (Thu Jun 06 2024) (latest is 2.9.0)",
    "schema 3.3.39 (core)",
    "settings 2.4.2 (core)",
    "signups 2.3.12 (user) published 153 days ago (Sat Jun 15 2024) (latest is 2.6.3)",
    "sobject 1.4.44 (core)",
    "telemetry 3.6.18 (core)",
    "templates 56.3.26 (core)",
    "trust 3.7.38 (core)",
    "user 3.6.0 (core)",
    "sfdmu 4.33.17 (user) published 197 days ago (Thu May 02 2024) (latest is 4.36.7)",
    "sfdx-git-delta 5.40.2 (user) published 155 days ago (Thu Jun 13 2024) (latest is 5.49.4)"
  ]
}

Goal

I want to insert records using sf data import bulk from a CSV file.

Issue

We are running Windows. The CSV file uses LF line endings. The CLI does not recognize this, and attempts to upload the file using CRLF endings, which causes a mismatch issue. Rerunning the import command using the --line-ending LF flag does not affect the behavior of the CLI, and we receive the same error telling us that it's trying to use CRLF endings during upload, which causes an error.

Error message:

PS C:\Projects\DigitalCore> sf data import bulk -o orgName -f fileWithLfLineEndings.csv --line-ending LF
───────────────── Importing data ─────────────────

✔ Creating ingest job 3.06s
✘ Processing the job 5.58s
   ▸ Processed records: ✘
   ▸ Successful records: ✘
   ▸ Failed records: ✘
/lightning/setup/AsyncApiJobStatus/page?address=%2F750QI00000BCEbxYAH)
Elapsed Time: 9.04s

Error (JobFailedError): Job failed to be processed due to:

ClientInputError : LineEnding is invalid on user data. Current LineEnding setting is CRLF

To review the details of this job, run this command:

sf org open --target-org test-bvhex8kgknjm@example.com --path "/lightning/setup/AsyncApiJobStatus/page?address=%2F750QI00000BCEbxY

Workaround

We are able to work around this issue by changing the line endings in the CSV file to CRLF using a text editor or shell utility.

Expected behaviour

The --line-ending LF flag causes the CLI to perform an upload using LF line endings, instead of ignoring it and using CRLF all the time.

Additional info

The help info for the command contains a typo:

--line-ending=<option>  Line ending used in the CSV file. Default value on Windows is `CRLF`; on macOS and Linux it's `LR`.
                              <options: CRLF|LF>

Presumably 'LR' should be 'LF'.

github-actions[bot] commented 2 hours ago

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[bot] commented 2 hours ago

Hello @OscarTheGrinch :wave: None of the versions of sf you shared match the latest release.

Shared: 2.65.8 Latest: 2.66.7

Update to the latest version of Salesforce CLI (docs) and confirm that you're still seeing your issue. You can also try the rc and nightly releases! (docs)

After updating, share the full output of sf version --verbose --json

WillieRuemmele commented 2 hours ago

Hey @OscarTheGrinch - we're aware, and already working on the fix!

OscarTheGrinch commented 2 hours ago

Hi @WillieRuemmele , thanks for the lightning fast response! (Pun somewhat intended) In that case I'll close this ticket, and watch the PR.