Skip to content

The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint. #2013

@matheusvetor

Description

@matheusvetor

Issue description

Hello, i'm on a legacy project who runs on rails 4.2.8 and i'm trying to upload a file to s3.

I'm getting the the error The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.. The error happens on obj.acl = 'public-read'. I tried do a google search, see the v1 documentation and search on project issues but no succeed.

Gem name

aws-sdk (1.66.0)

Version of Ruby, OS environment

2.2.5, debian - jessie (running on docker)

Code snippets / steps to reproduce

All the ENV variables are populated and the app can read them.

    require 'aws-sdk-v1'

    AWS.config({
      region: ENV['S3_REGION'],
      access_key_id: ENV['AWS_ACCESS_KEY_ID'],
      secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
    })

    object_name = 'testfile.jpg'

    s3 = AWS::S3.new
    bucket = s3.buckets[ENV['S3_BUCKET_NAME']]

    obj = bucket.objects[object_name]
    obj.acl = 'public-read'
    obj.write(Pathname.new(File.join(Rails.root, "tmp/", object_name)))

I already try to put the endpoint on AWS.config:

    AWS.config({
      region: ENV['S3_REGION'],
      access_key_id: ENV['AWS_ACCESS_KEY_ID'],
      secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
      endpoint: 's3.eu-central-1.amazonaws.com'
    })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions