Replies: 1 comment
-
Hi @gspetrou , Thanks for opening the issue. I think there might be some confusion regarding the differences between S3 and S3client. Both S3 and S3client take the same config type as input, and not each other as input. So either use the modular style SDK client import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
const s3Client = new S3Client({region: 'us-west-1'});
try {
const response = await s3Client.send(new GetObjectCommand({ Bucket: 'my-bucket', Key: 'my-key'}));
console.log(response);
} catch (err){
console.log(err);
} Or use the "v2-style" client: import { S3 } from "@aws-sdk/client-s3";
const s3 = new S3({ region: 'us-west-1' });
try {
const response = await s3.getObject({ Bucket: 'my-bucket', Key: 'my-key' }).promise();
console.log(response);
} catch (err) {
console.error(err);
} I hope this clears up any confusion. Let us know if you have further questions or issues. Thanks, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checkboxes for prior research
Describe the bug
Consider the following code, imagining that we're running from a Lambda in
us-west-2
.When creating a "v2 style" (or "higher level") client by passing in a "v3-style" (or "lower level") client, the config parameters of the lower-level client are ignored by the higher level client. In the example above, the GetObject API call is made using the
us-west-2
S3 endpoint where the Lambda is running from, rather thanus-west-1
where the bucket exists. Resulting in a "PermanentRedirect" error.SDK version number
@aws-sdk/client-s3@^3.427.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
Node 18 Lambda
Reproduction Steps
Observed Behavior
Error thrown:
Notice that the
endpoint
states the correct S3 endpoint, however when inspecting the entireS3
client object I noticed the following:Expected Behavior
The GetObject call goes to
us-west-1
and succeedsPossible Solution
No response
Additional Information/Context
Feel free to reach out internally as well, I'm an AWS employee (
gspetrou
)Beta Was this translation helpful? Give feedback.
All reactions