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

Javascript await error from `sfdx force:data:bulk:upsert --serial` #3112

Open JamesHaugheySlalom opened 2 weeks ago

JamesHaugheySlalom commented 2 weeks ago

Summary

As per https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_mig_bulk_data.htm we are continuing to use the sfdx commands to upsert file serially. Running sfdx force:data:bulk:upsert --file $1 --sobject $2 --external-id ExternalId__c --target-org $targetOrg --serial --wait 60 - this command now gives the javascript error below

Bulk Upsert...Warning: Detected unsettled top-level await at file:///usr/local/lib/nodejs/lib/node_modules/@salesforce/cli/bin/run.js:15
await cli.run();

This is running in the latest container version of docker.io/salesforce/cli:2.68.0-full but seems to have been introduced in the 2.66.5 version as the 2.66.4 version does not error.

Steps To Reproduce

Run sfdx force:data:bulk:upsert --file $file --sobject $sobject --external-id $external_id --target-org $target_org --serial --wait 60 in the Salesforce cli container docker.io/salesforce/cli:2.68.0-full

Expected result

sfdx cli should have uploaded a file serially to Salesforce

Actual result

Javascript errored on a unsettled await command

System Information

{
  "architecture": "linux-x64",
  "cliVersion": "@salesforce/cli/2.68.0",
  "nodeVersion": "node-v22.10.0",
  "osVersion": "Linux 5.15.78-0-virt",
  "rootPath": "/usr/local/lib/nodejs/lib/node_modules/@salesforce/cli",
  "shell": "bash",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.8 (core)",
    "@oclif/plugin-commands 4.1.8 (core)",
    "@oclif/plugin-help 6.2.16 (core)",
    "@oclif/plugin-not-found 3.2.25 (core)",
    "@oclif/plugin-plugins 5.4.15 (core)",
    "@oclif/plugin-search 1.2.14 (core)",
    "@oclif/plugin-update 4.6.10 (core)",
    "@oclif/plugin-version 2.2.15 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.21 (core)",
    "@oclif/plugin-which 3.2.17 (core)",
    "@salesforce/cli 2.68.0 (core)",
    "apex 3.6.2 (core)",
    "api 1.3.2 (core)",
    "auth 3.6.73 (core)",
    "data 3.11.3 (core)",
    "deploy-retrieve 3.15.11 (core)",
    "info 3.4.18 (core)",
    "limits 3.3.39 (core)",
    "marketplace 1.3.4 (core)",
    "org 5.1.5 (core)",
    "packaging 2.9.0 (core)",
    "schema 3.3.40 (core)",
    "settings 2.4.4 (core)",
    "sobject 1.4.45 (core)",
    "telemetry 3.6.20 (core)",
    "templates 56.3.29 (core)",
    "trust 3.7.41 (core)",
    "user 3.6.2 (core)"
  ]
}
github-actions[bot] commented 2 weeks 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 weeks ago

Hello @JamesHaugheySlalom :wave: It looks like you didn't include the full Salesforce CLI version information in your issue. Please provide the output of version --verbose --json for the CLI you're using (sf or sfdx).

A few more things to check:

Thank you!

WillieRuemmele commented 2 weeks ago

Hi @JamesHaugheySlalom - I've been testing this with the same version of the CLI/plugin/node and have yet to reproduce it ☹️

➜  sf version --verbose
 CLI Version:
    @salesforce/cli/2.68.0 published 0 days ago (Wed Nov 13 2024) (latest is 2.66.7)

 Architecture:
    darwin-arm64

 Node Version:
    node-v22.10.0

 Plugin Version:
    data 3.11.3 (core)

 OS and Version:
    Darwin 23.6.0

 Shell:
    zsh

 Root Path:
    /Users/william.ruemmele/.nvm/versions/node/v22.10.0/lib/node_modules/@salesforce/cli

➜  dreamhouse-lwc git:(main) ✗  hub:(GLOBAL - DevHub) scratch:(test-xvbapsbkzfgy@example.com)
 ➜  sf force data bulk upsert --file account.csv --sobject Account --external-id Id --wait 30 --target-org target --serial

Will poll the batch statuses every 5 seconds.
To fetch the status on your own, press CTRL+C and use the command:
...

Even looking at the 2.66.5 release. I don't see any changes that would obviously have that affect. It's still requiring the same minimum node version (18). I'll keep looking 💪 , just wanted to post an update

JamesHaugheySlalom commented 6 days ago

It looks like there was a major node upgrade in the Docker image from v20 to v22 right when the bug got introduced so that might be a possible cause? image

WillieRuemmele commented 3 days ago

maybe, you can use the -slim docker build to get only the CLI, and not node, so you can play around with the different node versions