Skip to content

Unsettled top-level await at sf force data bulk upsert #3180

Open
@pawel-id

Description

Summary

Salesforce CLI upsert command is failing on node.js v22 due to unsettled top-level await. Problem is not happening on node.js v20 or lower.

Steps To Reproduce

The problem can be replicated on any scratch org or sandbox. The simplest way is to use empty scratch org as provided below.

Clone repository https://github.com/pawel-id/unsettled and use its content in replication steps

  1. Check prerequisites:

    • node.js v22
    • @salesforce/cli/2.71.6
    • provide DevHub for scratch org creation
  2. Create scratch
    sf org create scratch -f config/project-scratch-def.json -v devhub -w 10 -a scratch

  3. Deploy the custom object sf project deploy start -o scratch

  4. Upsert some data
    sf force data bulk upsert -f data/ProductExternalData.csv -s ProductExternalData__c -i MaterialCode__c -w 15 -r -o scratch

Expected result

Graceful exit returning code 0

Actual result

On node.js 22 or later the upsert command finishes with an error and returns code 13:

Bulk Upsert... ⢿
Warning: Detected unsettled top-level await at file:///Users/pawel/.nvm/versions/node/v22.11.0/lib/node_modules/@salesforce/cli/bin/run.js:15
await cli.run();
^

The error will not happen when using node.js v20 or lower instead of v22.

Additional information

The object and upserted data represent anonymised data from environment where this issue was originally encountered. It might be possible to create simpler replicable scenario.

Similar problem has been reported here #3112

System Information

Problem has been replicated on macos with bash and linux. Windows wasn't tested however it is expected to behave the same.

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.71.6",
  "nodeVersion": "node-v22.11.0",
  "osVersion": "Darwin 24.2.0",
  "rootPath": "/Users/pawel/.nvm/versions/node/v22.11.0/lib/node_modules/@salesforce/cli",
  "shell": "bash",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.14 (core)",
    "@oclif/plugin-commands 4.1.14 (core)",
    "@oclif/plugin-help 6.2.19 (core)",
    "@oclif/plugin-not-found 3.2.31 (core)",
    "@oclif/plugin-plugins 5.4.22 (core)",
    "@oclif/plugin-search 1.2.17 (core)",
    "@oclif/plugin-update 4.6.18 (core)",
    "@oclif/plugin-version 2.2.18 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.28 (core)",
    "@oclif/plugin-which 3.2.21 (core)",
    "@salesforce/cli 2.71.6 (core)",
    "apex 3.6.8 (core)",
    "api 1.3.2 (core)",
    "auth 3.6.82 (core)",
    "community 3.3.6 (user) published 46 days ago (Sat Nov 30 2024) (latest is 3.3.8)",
    "data 3.13.5 (core)",
    "deploy-retrieve 3.16.0 (core)",
    "info 3.4.29 (core)",
    "limits 3.3.43 (core)",
    "marketplace 1.3.7 (core)",
    "org 5.2.11 (core)",
    "packaging 2.9.7 (core)",
    "schema 3.3.45 (core)",
    "settings 2.4.9 (core)",
    "signups 2.6.8 (user) published 39 days ago (Sat Dec 07 2024) (latest is 2.6.10)",
    "sobject 1.4.46 (core)",
    "telemetry 3.6.27 (core)",
    "templates 56.3.34 (core)",
    "trust 3.7.51 (core)",
    "user 3.6.5 (core)",
    "@salesforce/sfdx-scanner 4.7.0 (user) published 78 days ago (Tue Oct 29 2024) (latest is 4.8.0)",
    "sfdmu 4.38.0 (user) published 17 days ago (Sun Dec 29 2024)",
    "sfdx-git-delta 5.52.0 (user) published 22 days ago (Mon Dec 23 2024) (latest is 6.1.0)"
  ]
}

Metadata

Assignees

No one assigned

    Labels

    bugIssue or pull request that identifies or fixes a bugvalidatedVersion information for this issue has been validated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions