-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
I'm not sure if this is an issue on the s3 shard or not, but I get this error:
<Code>PermanentRedirect</Code>
<Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>
<Endpoint>s3.amazonaws.com</Endpoint>My code looks like this:
client = Awscr::S3::Client.new("us-west-1", aws_key_id, aws_secret)
Shrine.configure do |config|
config.storages["store"] = Shrine::Storage::S3.new(bucket: "my-app/avatars", client: client, public: true)
end
# other code...
result = Shrine.upload(upload_io, "store", metadata: { "filename" => "face.jpg" })
result.urlThe file fails to upload with an error similar to above.
One thing I noticed was that on this bucket, all of the file URLs actually have bucket.region.aws.com/subfolder instead of region.aws.com/bucket/subfolder.... So what I did was added the endpoint option to my client
client = Awscr::S3::Client.new("us-west-1", aws_key_id, aws_secret, endpoint: "https://my-app.s3-us-west-1.amazonaws.com/")
Now the file actually uploads (though it sets the content-type to octetstream... 🤔 ), but the URL I get back is
https://s3-us-west-1.amazonaws.com/my-app/avatars/.....lotsmorestuff
which sends me to the S3 error page above.
Metadata
Metadata
Assignees
Labels
No labels