ex_aws_s3
ex_aws_s3 copied to clipboard
dialyzer "no_return" on ExAws.S3.presigned_post
Environment
- Elixir & Erlang versions (elixir --version):
Elixir 1.14.4 (compiled with Erlang/OTP 25)
- ExAws version
mix deps |grep ex_aws
* ex_aws 2.5.3 (Hex package) (mix)
locked at 2.5.3 (ex_aws) 67115f1d
* ex_aws_s3 2.5.3 (Hex package) (mix)
locked at 2.5.3 (ex_aws_s3) 4f09dd37
- HTTP client version. IE for hackney do
mix deps | grep hackney
* hackney 1.20.1 (Hex package) (rebar3)
locked at 1.20.1 (hackney) fe9094e5
Current behavior
code sample:
def generate_presigned_post(%{filename: filename}) do
config = Application.get_env(:server, __MODULE__)
opts = [
expires_in: config[:expire_after_hours],
content_length_range: [config[:min_size_bytes], config[:max_size_bytes]],
virtual_host: config[:virtual_host],
starts_with: ["$Content-Type", config[:content_type_starts_with]]
]
ExAws.Config.new(:s3, [])
|> ExAws.S3.presigned_post(config[:bucket], config[:path] <> filename, opts)
end
errors and stacktraces
> mix dialyzer
...
((module calling generate_presigned_post)):no_return
The created anonymous function has no local return.
________________________________________________________________________________
lib/server/s3.ex:10:no_return
Function generate_presigned_post/1 has no local return.
________________________________________________________________________________
done (warnings were emitted)
Halting VM with exit status 2
Expected behavior
dialyzer should succeed
when i remove the call to ExAws.S3.presigned_post
dialyzer succeeds; it is the bottom function call in my project
this may be due to a bad @spec
somewhere, i've recently fixed this issue by updating a @spec
i am fixing this temporarily in my project by configuring dialyzer to ignore generate_presigned_post
thank you for your consideration :)