You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI doesn't work with node v24.17.0 or later. #3586
Error received :
Warning: Detected unsettled top-level await at file://node_modules/@salesforce/cli/bin/run.js:15 await cli.run();
I am using Salesforce CLI version 2.139.6 installed via npm (@salesforce/cli) and running the command in CI with:
Node.js: v24 (and also tested with v22)
OS: GitHub Actions Ubuntu runner
The issue is reproducible consistently with:
sf org login sfdx-url --sfdx-url-file --alias --json
Error observed:
Warning: Detected unsettled top-level await at @salesforce/cli/bin/run.js
The same setup works correctly with Node.js v20, but fails on Node 22 and 24 with the above runtime warning and CLI failure during bootstrap.
Please confirm if Salesforce CLI 2.139.x supports Node 24 in npm-based installations, or if there is a known compatibility issue with the CLI bootstrap process under Node 24.
Reacted by Matthias Rolke, CelloH3r0, Alan Jaouen, Noel Light-Hilary, Theodoor van Donge, Stefan Fisk, tmass-alt, wpluzek, Gareth Wilson, Jørgen Haaland and 2 more
Hello @PankajamM 👋 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:
Make sure you've provided detailed steps to reproduce your issue.
A repository that clearly demonstrates the bug is ideal.
Make sure you've installed the latest version of Salesforce CLI. (docs)
Better yet, try the rc or nightly versions. (docs)
Try running the doctor command to diagnose common issues.
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.
I am using Salesforce CLI version 2.139.6 installed via npm (@salesforce/cli) and running the command in CI with:
Node.js: v24 (and also tested with v22)
OS: GitHub Actions Ubuntu runner
The issue is reproducible consistently with:
sf org login sfdx-url --sfdx-url-file --alias --json
Error observed:
Warning: Detected unsettled top-level await at @salesforce/cli/bin/run.js
The same setup works correctly with Node.js v20, but fails on Node 22 and 24 with the above runtime warning and CLI failure during bootstrap.
Please confirm if Salesforce CLI 2.139.x supports Node 24 in npm-based installations, or if there is a known compatibility issue with the CLI bootstrap process under Node 24.
Hi folks, I hit this same issue and asked Claude to help me with the root-cause analysis. I hope it helps:
Root cause: the bundled [email protected] (via @jsforce/jsforce-node) fails to
decompress gzip responses on Node ≥22, and jsforce-node swallows the resulting stream
error, so the request promise never settles — which is what surfaces as the "unsettled
top-level await" / exit 13.
It is NOT specific to org login sfdx-url — it hits any command that makes an API call
(login, org display, deploy, query, bulk; org list with no saved org only "works"
because it makes no network call).
Mechanism (traced with async_hooks + node-fetch in isolation):
The request itself is fine — the OAuth/token call returns HTTP 200. The failure is in
reading the response body.
node-fetch sends Accept-Encoding: gzip; Salesforce responds Content-Encoding: gzip.
On Node ≥22, node-fetch 2.7.0's gunzip stream throws FetchError: ... Premature close.
Node's built-in fetch (undici) and raw https read the same response fine, so this is a
node-fetch v2 incompatibility with Node ≥22's stricter stream-end handling, not a Node
core bug.
In @jsforce/jsforce-node/lib/request.js (startFetchRequest) the body is consumed via res.body.pipe(output) (→ request-helper.js → util/stream.jsreadAll). .pipe()
does not forward the source's error, and there's no error handler on res.body, so
the "Premature close" is swallowed. readAll resolves on the downstream 'finish',
which never fires; the socket has already closed so no libuv handle remains, the loop
drains, and await cli.run() is left unsettled → exit 13.
Minimal proof (Node 24):
constfetch=require('node-fetch');// the 2.7.0 bundled by the CLIconstres=awaitfetch(url,{method:'POST', body, headers });// 200, content-encoding: gzipawaitres.text();// ❌ "Premature close" on Node 22/24, ✅ on 18/20// res with { compress:false } // ✅ on all versions (no gzip requested)
Reacted by PankajamM, Wyatt Pearsall and Nitin Parasa
Warning: Detected unsettled top-level await at .../@salesforce/cli/bin/run.js:15
await cli.run();
In the working versions, sf doctor completes and writes the diagnosis JSON file.
Since all failing versions are Node.js June 18, 2026 security releases, while the immediately preceding versions work, this appears to be triggered by the June 18 Node.js security updates rather than by a specific Node.js major version.
Hope this helps narrow it down.
Reacted by PankajamM, Matthias Rolke and sakkukasettySagecom
@branderson-js , neither, actually.
The CLI depends on jsforce, a third-party library that we play a very active role in maintaining. The latest minor versions of Node broke node-fetch@v2, which is a dependency of jsforce, and therefore broke the CLI.
The fix was to migrate away from node-fetch and to the native fetch API introduced to Node in v18.
Understood. we are on node v22.9.0 and have not seen any issues. I am just trying to determine if I hold off updating our sf cli version or change our node version
Hey everyone. It's our belief that this issue should be resolved in the latest nightly CLI build. If you run npm install --global @salesforce/cli@nightly, and then run your commands, do you still experience the error?
@nightly installed v2.142.1 and I do not receive an authentication failure or --target-org requirement
@branderson-js , the issue is reproducible on any version of the CLI (except for the new nightly), as long as your Node version is one of the ones released last Friday (v22.23.0, v24.17.0, or v26.3.1). According to @Bartheleway , it's also been fixed in the version of v24 released today, which is great news.
@br0bison , excellent news! That being the case, I'm going to close this Issue.
If anyone is still experiencing problems, please add additional comments here and we can re-open the issue if needed.
@branderson-js , neither, actually. The CLI depends on jsforce, a third-party library that we play a very active role in maintaining. The latest minor versions of Node broke node-fetch@v2, which is a dependency of jsforce, and therefore broke the CLI. The fix was to migrate away from node-fetch and to the native fetch API introduced to Node in v18.
Yes correct, a minor security fix in NodeJs created an issue in node-fetch which is used by jsforce itself used by sf cli.
Several ways for fixing were possible:
Wait for NodeJs to fix the fix: They did fix it in 22.23.1, 24.18.0 and 26.4.0.
Wait for a fix in node-fetch: Not gonna happen as project seems dead
Migrate away from node-fetch in jsforce and update jsforce in @salesforce/cli to avoid future issues: Done in nightly it seems.
@Bartheleway - I believe you might want to re-open this.
using @nightly i can 100% login via jwt - however, the JIT install of signups fails. So when I move on from authentication to running sf org snapshot list --target-dev-hub devHub --json it dies with the exact same error:
Querying DevHub for latest active baseline snapshot...
Warning: sf stderr output: @salesforce/cli: Installing plugin [email protected]... installed v2.6.73
Warning: Detected unsettled top-level await at file:///opt/hostedtoolcache/node/24.17.0/x64/lib/node_modules/@salesforce/cli/bin/run.js:15
await cli.run();
^
Error: Failed to query snapshots (exit 13):
Error: Process completed with exit code 1.
Reacted by Matthias Rolke, Christian Szandor Knapp, Nitin Parasa and Evan Kennedy
Activity
github-actions commentedon Jun 20, 2026
Hello @PankajamM 👋 It looks like you didn't include the full Salesforce CLI version information in your issue.
Please provide the output of
version --verbose --jsonfor the CLI you're using (sforsfdx).A few more things to check:
rcornightlyversions. (docs)doctorcommand to diagnose common issues.Thank you!
github-actions commentedon Jun 20, 2026
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.
PankajamM commentedon Jun 20, 2026
Thanks for the response.
I am using Salesforce CLI version 2.139.6 installed via npm (@salesforce/cli) and running the command in CI with:
Node.js: v24 (and also tested with v22)
OS: GitHub Actions Ubuntu runner
The issue is reproducible consistently with:
sf org login sfdx-url --sfdx-url-file --alias --json
Error observed:
Warning: Detected unsettled top-level await at @salesforce/cli/bin/run.js
The same setup works correctly with Node.js v20, but fails on Node 22 and 24 with the above runtime warning and CLI failure during bootstrap.
Please confirm if Salesforce CLI 2.139.x supports Node 24 in npm-based installations, or if there is a known compatibility issue with the CLI bootstrap process under Node 24.
sauloefo commentedon Jun 21, 2026
Hi folks, I hit this same issue and asked Claude to help me with the root-cause analysis. I hope it helps:
Root cause: the bundled
[email protected](via@jsforce/jsforce-node) fails todecompress gzip responses on Node ≥22, and jsforce-node swallows the resulting stream
error, so the request promise never settles — which is what surfaces as the "unsettled
top-level await" / exit 13.
Repro matrix (CLI 2.139.6, @jsforce/jsforce-node 3.10.15 → node-fetch 2.7.0, linux):
Node 18.20.8 ✅ · 20.20.2 ✅ · 22.23.0 ❌ · 24.17.0 ❌
It is NOT specific to
org login sfdx-url— it hits any command that makes an API call(login, org display, deploy, query, bulk;
org listwith no saved org only "works"because it makes no network call).
Mechanism (traced with async_hooks + node-fetch in isolation):
reading the response body.
Accept-Encoding: gzip; Salesforce respondsContent-Encoding: gzip.On Node ≥22, node-fetch 2.7.0's gunzip stream throws
FetchError: ... Premature close.Node's built-in fetch (undici) and raw https read the same response fine, so this is a
node-fetch v2 incompatibility with Node ≥22's stricter stream-end handling, not a Node
core bug.
@jsforce/jsforce-node/lib/request.js(startFetchRequest) the body is consumed viares.body.pipe(output)(→request-helper.js→util/stream.jsreadAll)..pipe()does not forward the source's
error, and there's noerrorhandler onres.body, sothe "Premature close" is swallowed.
readAllresolves on the downstream'finish',which never fires; the socket has already closed so no libuv handle remains, the loop
drains, and
await cli.run()is left unsettled → exit 13.Minimal proof (Node 24):
trysmr commentedon Jun 21, 2026
Hi,
I’m seeing what looks like the same issue, but with a narrower reproduction around the June 18, 2026 Node.js security releases.
I tested the same Salesforce CLI version with the immediately preceding Node.js versions and the June 18 security release versions.
Environment:
Command:
Working:
Failing:
Observed failure:
The command does not complete. It stops after:
Then Node.js prints:
In the working versions, sf doctor completes and writes the diagnosis JSON file.
Since all failing versions are Node.js June 18, 2026 security releases, while the immediately preceding versions work, this appears to be triggered by the June 18 Node.js security updates rather than by a specific Node.js major version.
Hope this helps narrow it down.
nwcm commentedon Jun 22, 2026
Also seeing this issue. With either
@salesforce/cli/2.130.9 win32-x64 node-v22.23.0
@salesforce/cli/2.138.6 win32-x64 node-v24.17.0
rsstan commentedon Jun 22, 2026
I encountered the same issue with both of the following versions:
The issue disappeared after I downgraded Node.js to
v24.12.0.SalikLP commentedon Jun 22, 2026
I have the same issue. Even running
sf org listorsf org displaygives the error:git2gus commentedon Jun 22, 2026
This issue has been linked to a new work item: W-23121570
14 remaining items
jfeingold35 commentedon Jun 26, 2026
@branderson-js , neither, actually.
The CLI depends on
jsforce, a third-party library that we play a very active role in maintaining. The latest minor versions of Node brokenode-fetch@v2, which is a dependency ofjsforce, and therefore broke the CLI.The fix was to migrate away from
node-fetchand to the nativefetchAPI introduced to Node in v18.branderson-js commentedon Jun 26, 2026
Understood. we are on node
v22.9.0and have not seen any issues. I am just trying to determine if I hold off updating oursfcli version or change our node versionbr0bison commentedon Jun 26, 2026
@nightly installed v2.142.1 and I do not receive an authentication failure or --target-org requirement
Can confirm using @nightly resolved our issues.
jfeingold35 commentedon Jun 26, 2026
@branderson-js , the issue is reproducible on any version of the CLI (except for the new
nightly), as long as your Node version is one of the ones released last Friday (v22.23.0, v24.17.0, or v26.3.1). According to @Bartheleway , it's also been fixed in the version of v24 released today, which is great news.jfeingold35 commentedon Jun 26, 2026
@br0bison , excellent news! That being the case, I'm going to close this Issue.
If anyone is still experiencing problems, please add additional comments here and we can re-open the issue if needed.
Bartheleway commentedon Jun 26, 2026
Yes correct, a minor security fix in NodeJs created an issue in
node-fetchwhich is used byjsforceitself used bysf cli.Several ways for fixing were possible:
node-fetch: Not gonna happen as project seems deadnode-fetchinjsforceand updatejsforcein@salesforce/clito avoid future issues: Done in nightly it seems.We should be safe now.
branderson-js commentedon Jun 29, 2026
Would the change of which
fetchthesfcli is using had an effect on proxy usage?codefriar commentedon Jun 29, 2026
@Bartheleway - I believe you might want to re-open this.
using @nightly i can 100% login via jwt - however, the JIT install of signups fails. So when I move on from authentication to running
sf org snapshot list --target-dev-hub devHub --jsonit dies with the exact same error:ZergyPoo commentedon Jul 14, 2026
This error is still stopping me from using the CLI this morning. Can we re-open the issue?
ZergyPoo commentedon Jul 14, 2026
I can't even install the nightly version, I encounter the same await error when attempting to run
sf upgrade nightlyci(prepare-org): move the Node pin from 24.16.0 to 24.22.1 (#591)