Skip to content
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

ActiveStorage direct uploads can't specify a service_name? #38940

Open
scottjg opened this issue Apr 13, 2020 · 15 comments
Open

ActiveStorage direct uploads can't specify a service_name? #38940

scottjg opened this issue Apr 13, 2020 · 15 comments

Comments

@scottjg
Copy link

scottjg commented Apr 13, 2020

hey @DmitryTsepelev -- I brought my app to rails master, so that i could try out your PR: #34935

unfortunately, I can't seem to figure out how direct uploads can respect the service specified in the model? DirectUploadsController doesn't seem to allow passing in a service (though I'm not sure you'd want that to be user controlled necessarily?). I was expecting somehow for the rails form helpers to somehow signal to the DirectUploadsController what service to use, based on the model it was posting to.

I'm assuming I'm just missing something, but it seems like there might not be a way to use direct uploads with your PR changes? I guess you could write your own DirectUploadsController?


Steps to reproduce

use a form_with in your erb that points to a model, make a file field the same name as a has_one_attached field and direct_upload: true. then upload a file via your web browser

Expected behavior

direct upload will be directed at the service specified in the model

Actual behavior

direct upload goes to the default storage adapter

System configuration

Rails version: c1ccc6a0d240

Ruby version: 2.5.1p7

@DmitryTsepelev
Copy link
Contributor

Hi @scottjg! I've reproduced the issue and investigating, thanks for catching that!

@scottjg
Copy link
Author

scottjg commented Apr 14, 2020

as a temporary workaround for my app, i implemented my own controller/route for direct uploads:

class DirectVideoUploadsController < ActiveStorage::DirectUploadsController
  private
    def blob_args
      super.merge({
        service_name: Rails.env.production? ? :aws_video_input : :aws_video_input_dev,
      })
    end
end

@DmitryTsepelev
Copy link
Contributor

@scottjg here is a possible fix #38957, could you please take a look when you have a moment?

@rails-bot
Copy link

rails-bot bot commented Jul 14, 2020

This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the 6-0-stable branch or on master, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.

@rails-bot rails-bot bot added the stale label Jul 14, 2020
@scottjg
Copy link
Author

scottjg commented Jul 14, 2020

#38957 was never merged, so this is still an issue.

@rails-bot rails-bot bot removed the stale label Jul 14, 2020
@rails-bot
Copy link

rails-bot bot commented Oct 12, 2020

This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the 6-0-stable branch or on master, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.

@rails-bot rails-bot bot added the stale label Oct 12, 2020
@DmitryTsepelev
Copy link
Contributor

it's still an issue

@rails-bot rails-bot bot removed the stale label Oct 12, 2020
@rails-bot
Copy link

rails-bot bot commented Jan 10, 2021

This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the 6-1-stable branch or on master, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.

@rails-bot rails-bot bot added the stale label Jan 10, 2021
@scottjg
Copy link
Author

scottjg commented Jan 11, 2021

still not fixed

@rails-bot rails-bot bot removed the stale label Jan 11, 2021
@gstokkink
Copy link

Still an issue unfortunately

@egorslam
Copy link

Still an issue

@ghiculescu
Copy link
Member

#38957 is the relevant PR

@skipkayhil
Copy link
Member

Closed by #38957

@scottjg
Copy link
Author

scottjg commented Aug 8, 2022

It appears the referenced PR was reverted. Was a different fix applied?

@skipkayhil
Copy link
Member

Ack, I didn't read the thread fully, thank you

@skipkayhil skipkayhil reopened this Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants