Skip to content

Getting systematic Timeout Error on PUT requests after bumping @smithy/node-http-handler from v4.3.0 to v4.4.2 #7466

@MathieuGuillet

Description

@MathieuGuillet

Checkboxes for prior research

Describe the bug

All the file uploads to S3 are failing after the dependency @smithy/node-http-handler moved from v4.3.0 to v4.4.2 (renovate bump).
Without changing anything than just reverting to v4.3.0 fixes the issue, so no doubt about the source of these timeout errors.
We couldn't understand what could be the issue though (looking at the changelogs between the v4.3.0 and the v4.4.2).
Testing with the version v4.4.3 didn't fix the issue.

Our use case is simple : just uploading a file to S3 using the S3Client. The file is not big (a text file with a maximum of 10k rows).
The read accesses to S3 are working well though.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@smithy/[email protected], @smithy/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

Node v22.14.0

Reproduction Steps

Here is how we create our S3Clients using node-http-handler:

import { S3Client } from '@aws-sdk/client-s3'
import { NodeHttpHandler } from '@smithy/node-http-handler'
import { HttpsProxyAgent } from 'https-proxy-agent'
import http from 'node:http'
import https from 'node:https'

type CreateS3ClientParams = {
  region: string
  stsRegion?: string
  endpoint?: string
}

export function createS3Client({ region, stsRegion, endpoint }: CreateS3ClientParams): S3Client {
  const httpProxy = process.env.HTTP_PROXY ?? process.env.http_proxy
  const httpsProxy = process.env.HTTPS_PROXY ?? process.env.https_proxy

  const config: Record<string, unknown> = {
    region,
    requestHandler: new NodeHttpHandler({
      httpAgent: httpProxy ? new HttpsProxyAgent(httpProxy) : new http.Agent({ keepAlive: true }),
      httpsAgent: httpsProxy ? new HttpsProxyAgent(httpsProxy) : new https.Agent({ keepAlive: true }),
    }),
    followRegionRedirects: true,
  }

  if (stsRegion && stsRegion !== region) {
    config.clientConfig = { region: stsRegion }
  }

  if (endpoint) {
    config.endpoint = endpoint
  }

  return new S3Client(config)
}

How we upload files using this S3Client:

new Upload({
    partSize: 1024 * 1024 * 5,
    client: s3Client,
    params: {
      Bucket: bucketName,
      Body: body,
      Key: fileName,
      ContentType: contentType,
    },
  }).done()

Here is our dependency list at the moment:

"dependencies": {
    "@aws-sdk/client-s3": "^3.901.0",
    "@aws-sdk/credential-providers": "^3.901.0",
    "@aws-sdk/signature-v4": "^3.374.0",
    "@aws-sdk/util-format-url": "^3.901.0",
    "@smithy/fetch-http-handler": "^5.3.1",
    "@smithy/hash-node": "^4.2.0",
    "@smithy/node-http-handler": "^4.3.0",
    "@smithy/protocol-http": "^5.3.3",
    "@smithy/types": "^4.6.0",
    "https-proxy-agent": "^7.0.6"
  }

Observed Behavior

Here is the error we get systematically when doing these Uploads with the node-http-handler v4.4.2 or v4.4.3 :

Error type : TimeoutError

AggregateError [ETIMEDOUT]: 
    at internalConnectMultiple (node:net:1139:18)
    at afterConnectMultiple (node:net:1712:7)
    at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17)

Expected Behavior

No timeout on uploads, as with the version 4.3.0.

Possible Solution

No response

Additional Information/Context

For now, we just froze the version to v4.3.0 to fix the issue.

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issuepotential-regressionMarking this issue as a potential regression to be checked by team member

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions