Skip to content

MIGRATION ISSUE: Region Is Not Being Set For S3 Client #5767

@TomerPacific

Description

@TomerPacific

Pre-Migration Checklist

Which JavaScript Runtime is this issue in?

Browser

AWS Lambda Usage

  • Yes, my application is running on AWS Lambda.
  • No, my application is not running on AWS Lambda.

Describe the Migration Issue

When migrating from AWS SDK JS V2 to V3, it was observed that it was needed to set the region for the S3 client being instantiated.
When printing the config object for the instantiated S3 client, the region is not observed there as opposed to the AWS SDK JS V2 config.

Below are code snippets from our code using AWS SDK JS V2:

import {S3} from "aws-sdk";
_s3:S3 = new S3({apiVersion: "2006-03-01"});

and using AWS SDK JS V3:

import {S3} from "@aws-sdk/client-s3";
this._s3 = new S3({region: 'us-east-1'});

I have also tried using:

import {S3Client} from "@aws-sdk/client-s3";
this._s3 = new S3Client({region: 'us-east-1'});

This is the output when I log the S3 client config in V3:
{"apiVersion":"2006-03-01","disableHostPrefix":false,"extensions":[],"logger":{},"serviceId":"S3","signingEscapePath":false,"runtime":"node","requestHandler":{"metadata":{"handlerProtocol":"http/1.1"},"configProvider":{}},"forcePathStyle":false,"useAccelerateEndpoint":false,"useGlobalEndpoint":false,"disableMultiregionAccessPoints":false,"defaultSigningName":"s3","tls":true,"isCustomEndpoint":false,"systemClockOffset":0,"followRegionRedirects":false,"s3ExpressIdentityProvider":{"cache":{"data":{},"lastPurgeTime":1707198854366}},"eventStreamMarshaller":{"universalMarshaller":{"eventStreamCodec":{"headerMarshaller":{},"messageBuffer":[],"isEndOfStream":false}}}}

And in V2:

{"credentials":{"expired":false,"expireTime":null,"refreshCallbacks":[],"accessKeyId":"ACCESS_KEY","profile":"default","disableAssumeRole":true,"preferStaticCredentials":false,"tokenCodeFn":null,"httpOptions":null},"credentialProvider":{"providers":[null,null,null,null,null,null,null],"resolveCallbacks":[]},**"region":"us-east-1"**,"logger":null,"apiVersions":{},"apiVersion":"2006-03-01","endpoint":"s3.amazonaws.com","httpOptions":{"timeout":120000},"maxRedirects":10,"paramValidation":true,"sslEnabled":true,"s3ForcePathStyle":false,"s3BucketEndpoint":false,"s3DisableBodySigning":true,"s3UsEast1RegionalEndpoint":"legacy","computeChecksums":true,"convertResponseTypes":true,"correctClockSkew":false,"customUserAgent":null,"dynamoDbCrc32":true,"systemClockOffset":0,"signatureVersion":"s3","signatureCache":true,"retryDelayOptions":{},"useAccelerateEndpoint":false,"clientSideMonitoring":false,"endpointCacheSize":1000,"hostPrefixEnabled":true,"stsRegionalEndpoints":"legacy"}

I am using this in a typescript project with Node16 on a mac machine with OS Ventura 13.5

Code Comparison

No response

Observed Differences/Errors

The region doesn't seem to be set on the S3 client. This results in the following error:

Error: read ECONNRESET
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) {
  errno: -54,
  code: 'ECONNRESET',
  syscall: 'read',
  name: 'TimeoutError',
  '$metadata': { attempts: 3, totalRetryDelay: 97 }
}

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.v2-v3-inconsistencyBehavior has changed from v2 to v3, or feature is missing altogether

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions