Repository navigation
Highlights
Fixes intermittent ERR_STREAM_PREMATURE_CLOSE ("Premature close") errors when fetching an OAuth access token on Node.js v24.17.0 and later.
A Node.js v24.17.0 change to http.Agent keep-alive socket teardown timing (the response-queue-poisoning fix) exposed a latent bug in node-fetch@2: gzip + chunked token responses read over a reused keep-alive socket would surface a false-positive premature-close error even though the full payload arrived. Because every API operation fetches a token first, this presented as failures across many calls (balance lookups, transfers, customer creation, webhook checks) in both production and sandbox.
Fix: the SDK now sends the token request with compress: false, so node-fetch skips the gzip pipeline that triggers the bug. The token payload is ~100 bytes, so this has no meaningful cost. See nodejs/node#63989.
Who should upgrade: anyone running the SDK on Node.js v24.17.0+. No code changes are required on your end.
What's Changed
- Disable node-fetch gzip on token request to fix ERR_STREAM_PREMATURE_CLOSE by @spencerhunter in #103
Full Changelog: v3.4.1...v3.4.2