-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 GetObject without region resolves mostly empty response with 301 redirect. #1446
Comments
Hi @monken @simonbuchan , in v3 SDK we have decided that the SDK base client won't follow the redirection automatically like previous SDK. But you are right, we should've throw that instead of swallow it. We will prioritize it before moving out of preview. I will close this one as it's duplicated to #1385 |
Verified that the error is thrown as expected in Codeconst AWS = require("aws-sdk");
const { S3 } = require("@aws-sdk/client-s3");
(async () => {
const region = "us-east-1";
const Bucket = `test-bucket-${Math.ceil(Math.random() * 10 ** 10)}`;
const Key = `Key`;
const Body = `Body`;
const v2Client = new AWS.S3({ region });
const v3Client = new S3({ region });
await v3Client.createBucket({ Bucket });
// Waiters missing in v3.
await v2Client.waitFor("bucketExists", { Bucket }).promise();
await v3Client.putObject({ Bucket, Key, Body });
try {
const client = new S3({ region: "us-west-2" });
console.log(await client.getObject({ Bucket, Key }));
} catch (e) {
console.log(e);
}
await v3Client.deleteObject({ Bucket, Key });
await v3Client.deleteBucket({ Bucket });
})(); Output
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Describe the bug
The SDK doesn't nicely handle missing (and incorrect?) regions, when this matters.
SDK version number
1.0.0-gamma.6
Is the issue in the browser/Node.js/ReactNative?
Node.js
Details of the browser/Node.js/ReactNative version
v14.4.0
To Reproduce (observed behavior)
Given simple code like the following, with valid values for
credentials
,Bucket
, andKey
, but whereBucket
is not in the default region:The response is:
Collapsed
This is no fun to handle!
Expected behavior
I would expect one of raising an error (not sure which?) or silently handling the redirect.
The text was updated successfully, but these errors were encountered: