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

ex-aws configuration is not used for presigned_url/4 #4

Open
rsullivan00 opened this issue Nov 14, 2017 · 5 comments
Open

ex-aws configuration is not used for presigned_url/4 #4

rsullivan00 opened this issue Nov 14, 2017 · 5 comments

Comments

@rsullivan00
Copy link

Environment

  • ExAws version 2.0.1

Current behavior

Currently, ExAws.S3.presigned_url requires a config map to be manually passed in to access things like our secret access key.

S3.presigned_url(
  ExAws.Config.new(:s3),
  :get,
  ...
),

It seems like this should happen implicitly using our ExAws S3 configuration, since other functions use our configuration automatically. For example,

ExAws.S3.list_buckets

Discovers our configuration internally.

Expected behavior

presigned_url behaves like other functions by discovering configuration

@rsullivan00 rsullivan00 changed the title ex-aws configuration is not used for presigned_url ex-aws configuration is not used for presigned_url/4 Nov 14, 2017
@benwilson512
Copy link
Contributor

Technically they do not use configuration automatically. Configuration is passed in to the ExAws.request/1,2 functions. The functions within the S3 module really don't use config at all with the one exception of the presigned_url fun.

I can look and see though if that config can be used by default.

@janajri
Copy link

janajri commented Feb 26, 2018

Just encountered this issue, but had no issues passing in the config map returned from ExAws.Config.new(). Could be useful to just add another f

@spec presigned_url(http_method :: atom, bucket :: binary, object :: binary, opts :: presigned_url_opts) :: {:ok, binary} | {:error, binary}

Happy to make a PR if you think it makes sense.

@aisrael
Copy link

aisrael commented Nov 21, 2019

Was trying to figure this out just now as well. At first I tried ExAws.Config.Defaults.default(:s3) but that gave a validation error.

@janajri's comment pointed the way out to me:

:s3 |>
ExAws.Config.new() |>
ExAws.S3.presigned_url(:put, "bucket", "object")

@aisrael
Copy link

aisrael commented Nov 22, 2019

I think a better approach would be to simply make ExAws.S3.presigned_url create the request, then the user has to pipe it to ExAws.request() to be consistent with the rest of the library?

@benwilson512
Copy link
Contributor

benwilson512 commented Nov 22, 2019 via email

bernardd pushed a commit that referenced this issue Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants