Repository navigation
Description
jsforce requests can hang indefinitely on Node.js 24.17.0.
The first visible failure in our app was:
await conn.authorize({
grant_type: 'client_credentials',
});After isolating the issue, OAuth auth and a normal REST query both work when jsforce sends connection: close.
The same code works on Node.js 24.16.0.
Environment
- jsforce versions inspected/tested:
3.6.63.7.03.9.13.10.16
node-fetch:2.7.0- Node.js:
- fails:
24.17.0 - works:
24.16.0
- fails:
- Platform:
- amd64
- arm64
Reproduction
import jsforce from 'jsforce';
const conn = new jsforce.Connection();
conn.oauth2 = new jsforce.OAuth2({
clientId: process.env.SALESFORCE_CLIENT_ID,
clientSecret: process.env.SALESFORCE_CLIENT_SECRET,
loginUrl: 'https://<my-domain>.develop.my.salesforce.com',
});
await conn.authorize({
grant_type: 'client_credentials',
});
const result = await conn.query(
'SELECT Id, CaseNumber, Status, Subject, LastModifiedDate FROM Case LIMIT 1',
);
console.log(result.records[0]);Observed Behavior
On Node.js 24.17.0, the jsforce request promise can remain unsettled.
In our validation:
- unpatched jsforce on Node.js
24.17.0leftconn.authorize({ grant_type: 'client_credentials' })unsettled. - adding only
content-lengthto the OAuth token POST did not fix the issue. - adding
connection: closefixed OAuth auth. - adding
connection: closein the shared jsforce request transport fixed both OAuth auth and a normal Case query.
Expected Behavior
jsforce requests should either complete successfully or fail with a bounded request error. They should not hang indefinitely on Node.js 24.17.0.
Suspected Cause
jsforce uses node-fetch@2 for its Node request transport. Node.js 24.17.0 uses keep-alive by default for http.globalAgent / https.globalAgent and includes HTTP/TLS security changes, including an http.Agent idle socket data guard and an llhttp update.
This appears to expose an incompatibility between jsforce's current request transport and Node.js 24.17.0 connection reuse behavior.
Diagnostic Workaround
In lib/request.js, setting connection: close for Node requests avoids the hang:
const headers = {
...(rrequest.headers ?? {}),
};
if (
!('window' in globalThis) &&
!('self' in globalThis) &&
!Object.keys(headers).some((headerName) => headerName.toLowerCase() === 'connection')
) {
headers.connection = 'close';
}
const fetchOpts = {
...rrequest,
headers,
...(input && /^(post|put|patch)$/i.test(request.method)
? { body: input }
: {}),
redirect: 'manual',
signal: controller.signal,
agent,
};Local validation showed that content-length alone does not fix the issue. connection: close is the only local workaround we found that avoids the hang, but it is not intended as the long-term jsforce fix.
Validation Result
With connection: close applied in the shared request transport, Node.js 24.17.0 successfully completed:
- OAuth
client_credentialsauth SELECT Id, CaseNumber, Status, Subject, LastModifiedDate FROM Case LIMIT 1
The query returned one Case record successfully.
Related Node.js Changes
Node.js 24.17.0 release:
https://nodejs.org/en/blog/release/v24.17.0
Relevant commits:
http.Agentresponse queue poisoning fix:
nodejs/node@be7e719llhttpupdate to9.4.2:
nodejs/node@cb2aed9
Activity
[-]jsforce requests hang on Node.js 24.17.0 unless connection reuse is disabled[/-][+]Node.js 24.17.0: jsforce request promise can hang with keep-alive transport[/+]kirill-meleshko commentedon Jun 18, 2026
Additional clarification:
Connection: closeshould be treated as a diagnostic workaround, not as the proposed jsforce fix.jsforce intentionally uses streaming request/response handling and persistent connections, and we do not think the long-term fix should be to disable keep-alive globally.
The important observation is:
24.17.0with the normal transport.24.16.0.Connection: closemakes the request settle on Node.js24.17.0.That suggests the issue is likely in the persistent connection / socket reuse path exposed by Node.js
24.17.0, not in Salesforce OAuth semantics specifically.So the desired outcome is to preserve jsforce's existing streaming + keep-alive behavior if possible, while identifying why the promise remains unsettled on Node.js
24.17.0.The
Connection: closepatch is useful only because it narrows the failure boundary to keep-alive / reusable socket handling.kirill-meleshko commentedon Jun 18, 2026
Related to nodejs/node#63989
sjgutta commentedon Jun 19, 2026
Ran into the same issue today, it was very difficult to debug since requests silently hang despite the request succeeding on the Salesforce side. Confirmed that the only way for us to get back to a working version was to downgrade our docker image back to a node version before these upgrades.
Will-Bill commentedon Jun 19, 2026
Well this had me stumped for 4 hours. Targeting dockerfile back to 24.16.0 fixes it for me. This issue is also on node 22. I am sure its on other node point releases too.
rtraficante commentedon Jun 19, 2026
Having the same issue. Authorization is hanging and failing. Haven't tested on any other node versions but direct calls to the salesforce authorization endpoint works just fine.
morganwynne commentedon Jun 19, 2026
I ran into the same issue with node 22 and narrowed it down to the new 22.23.0 security release from yesterday.
Muzammillcoste commentedon Jun 22, 2026
I faced the same issue, and it took 3 hours of debugging to find this fix.
lundstromdavid commentedon Jun 22, 2026
Same issue here, temporarily solved it by reverting to a compatible Node version. Skill issue that I didn't use a fixed Node version to be fair, but would love a fix for this so that I can keep Node updated!
GBvanDam commentedon Jun 22, 2026
same with 26.3.1, same security release was rolled out on 26, 24 and 22 https://nodejs.org/en/blog/vulnerability/june-2026-security-releases
fix: pin Node to 22 (jsforce #1806 hangs on Node 24.17.0); revert SF …
fix: pin Node to exact 22.22.3 (jsforce #1806 regression landed in 22…
fix: pin Node to 22.22.3 to avoid jsforce build hang (jsforce/jsforce…
jfeingold35 commentedon Jun 22, 2026
Hey everyone. We're aware of this issue and we're actively working to fix it. We'll provide more information as and when it becomes available. In the meantime, thank you for your patience.
Bartheleway commentedon Jun 26, 2026
Issue is fixed if you upgrade to v24.18 (nodejs/node#63989). I also created an issue for v26.3.1 (nodejs/node#64142) as they didn't fix it yet.
nbolton commentedon Jul 20, 2026
Thanks for fixing this, working great!