AWS SDK createBucket() succeeds but, hangs until timeout
Hi, I'm just using your Object Storage and it's been working great in nodejs with the AWS SDK (https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html)
The only peculiar thing is the createBucket()
method. The call succeeds in creating a bucket but, it never receives any callbacks for 'success', 'error' or 'completed'. It will just hang until a timeout occurs.
This seems like a bug since other methods work fine: listBuckets()
, headBucket()
, upload()
, listObjectsV2()
, deleteObjects()
, copyObject()
11 Replies
Glad to hear you're liking it so far!
Peculiar is a great word for this. I reached out to one of our engineers, and he said that they haven't been running into any issues with bucket creation on their end. So that we can better test this out, is it possible for you to provide the code you're running so we can see how the createBucket()
function is being called in this instance? Also, is this happening every time, or is it intermittent?
In the meantime, if you're able to, it might be worth trying this out using Python or Boto instead of JavaScript, since our engineer mentioned both of those seem to be working without a hitch.
Thanks in advance, and let us know if you're seeing anything else!
I also have the same issue with createBucket on the javascript aws sdk. It looks like the bucket also gets created multiple times in a delay where it would reappear after delete. Maybe some sort of retry.
The issue is consistent on my side. I have not had the request succeed even when the bucket gets created.
I'll get a minimal repro going, test the python sdk and report back.
const AWS = require("aws-sdk");
const s3Client = new AWS.S3({
region: "us-east-1",
endpoint: "us-east-1.linodeobjects.com",
apiVersion: "2006-03-01",
credentials: new AWS.Credentials({
accessKeyId: process.env.LINODE_OBJECT_STORAGE_ACCESS_KEY,
secretAccessKey: process.env.LINODE_OBJECT_STORAGE_SECRET_ACCESS_KEY
})
});
s3Client.createBucket({Bucket: 'foo'},
// for me, the 'foo' bucket gets created but this callback never gets called
function(err, data) {
if (err) {
console.log('Error', err);
return;
}
console.log("Data", data);
}
)
Hi,
I experience the exact same problem as described by bc-jasond.
Were you able to recreate the issue on your end? If not, want can I do to help?
Thanks!
@haches and @bc-jasond Our developers were unable to recreate this issue on our end. They were able to successfully create a bucket by including the following settings:
endpoint: "us-east-1.linodeobjects.com",
sslEnabled: true,
s3ForcePathStyle: false
That being said, troubleshooting these issues can be a bit difficult without access to the servers logs. If you have API logging enabled, reviewing the logs would provide further information about the failure.
You may need to adjust your SDK's timeout settings so that enough time is allowed for your API call to get a response.
Additional Resources
I had the same problem using createBucket
with aws-sdk. The problem is caused when createBucket
sets a LocationConstraint
, with this code extracted from s3.js:
if (hostname !== this.api.globalEndpoint &&
!params.CreateBucketConfiguration)
{
copiedParams.CreateBucketConfiguration = {
LocationConstraint: this.config.region
};
}
I tried calling createBucket
with CreateBucketConfiguration set to an empty object ({}), but it didn't work.
What did work was to add a line after creating the S3 client:
let s3Client = new AWS.S3({
region: "us-east-1",
endpoint: "us-east-1.linodeobjects.com",
sslEnabled: true,
s3ForcePathStyle: false,
apiVersion: "2006-03-01",
credentials: new AWS.Credentials({
accessKeyId: "my access key",
secretAccessKey: "my secret access key"
})
});
// override AWS api setting
s3Client.api.globalEndpoint = s3Client.config.endpoint;
Solved
I had opened a ticket for this and got feedback that the issue has been fixed. The important note: it's needed to set the LocationConstraint
s3.createBucket({Bucket: bucketName, CreateBucketConfiguration: {LocationConstraint: ""}}, ...)
With this, it's working as expected. Might be the same fix as what @schoolcoder suggested above.
I just got back to this code, thanks @schoolcoder and @haches - I chose to override the s3Client.api.globalEndpoint
and it works for me now 👍 because the request params no longer include CreateBucketConfiguration: {LocationConstraint: "us-east-1"}
This seems like a bug because I would expect the Linode Object Storage API to recognize what appear to be valid request params for the CreateBucketConfiguration
and LocationConstraint
values
This looks to be an issue across Linode Object Storage. I have reproduced it using rclone, although that does fail with a “bad request.”
Please see this thread: https://www.linode.com/community/questions/21321/problems-creating-object-storage-buckets-using-aws-sdk
Like yourself, I was able to get the request to succeed by not including a location constraint in the request.