-
Notifications
You must be signed in to change notification settings - Fork 592
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.putObject to a different region fails silently #1385
Comments
Hi @monken |
Verified that putObject fails with 301 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();
try {
const client = new S3({ region: "us-west-2" });
console.log(await client.putObject({ Bucket, Key, Body }));
await v3Client.deleteObject({ Bucket, Key });
} catch (e) {
console.log(e);
}
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
When calling s3.putObject on a bucket in a different region the call will succeed but the file is not actually uploaded. The response from S3 is a 301 redirect and the SDK accepts that as a valid response.
SDK version number
1.0.0-gamma.4
Is the issue in the browser/Node.js/ReactNative?
Node.js
Expected behavior
Throw an exception or follow the redirect and upload to the correct region. I'd prefer the exception because it involves less magic.
The text was updated successfully, but these errors were encountered: