janko / uppy-s3_multipart

Provides Ruby endpoints for AWS S3 multipart uploads in Uppy
https://uppy.io/docs/aws-s3/
MIT License
65 stars 21 forks source link

S3/multipart routes not populated correctly #11

Closed bbodien closed 5 years ago

bbodien commented 5 years ago

I'm feeling this is something I'm doing wrong rather than a bug, but I'm out of ideas

When I run rails routes I'm getting /s3/multipart #<Uppy::S3Multipart::App:0x00007fd16c119988 @router=#<Class:0x00007fd16c1193e8>> instead of the actual routed methods/verbs.

When I try and upload an image, I'm getting:

Rack app error handling request { POST /s3/multipart }
#<Aws::S3::Errors::AccessDenied: Access Denied>

I presume this is because the route isn't defined, as above.

I'm using uppy-s3-multipart v3.0.1 on rails v5.2.3, ruby v2.6.0.

# routes.rb
...
mount UPPY_S3_MULTIPART_APP => '/s3/multipart'
...
# intitializers/uppy.rb

require "uppy/s3_multipart"

resource = Aws::S3::Resource.new(
  access_key_id:     Rails.application.credentials.dig(:aws, :access_key_id),
  secret_access_key: Rails.application.credentials.dig(:aws, :secret_access_key),
  region:            "eu-west-2",
)

bucket = resource.bucket("keycentral-images")

UPPY_S3_MULTIPART_APP ||= Uppy::S3Multipart::App.new(
  bucket: bucket, 
  public: true
)
# config.ru

require_relative 'config/environment'

run Rails.application

map "/s3/multipart" do
  run UPPY_S3_MULTIPART_APP
end
bbodien commented 5 years ago

Apologies, I've just seen closed issue #5 in which you explained the routes output. I'll keep trying to work out why the access is being denied to Uppy then.