I am trying to upload to Storj S3 buckets.
What I tried?
using ex_aws
library to upload. BUt I am getting this error.
:path in URI must be empty or an absolute path if URL has a :host, got: %URI{authority: nil, fragment: nil, host: "gateway.ap1.storjshare.io",
path: "https:/gateway.ap1.storjshare.io/73bc549931824937b15209d8940ca1ff-voter-id-card-500x500.jpg", port: nil, query: "", scheme: "https", userinfo: nil}
relevant code
storj_base = "https://gateway.ap1.storjshare.io/"
file_uuid = UUID.uuid4(:hex)
image_filename = URI.encode(image_params.filename)
unique_filename = "#{file_uuid}-#{image_filename}"
upload_url = "#{storj_base}#{unique_filename}" |> IO.inspect()
{:ok, image_binary} = File.read(image_params.path)
bucket_name = System.get_env("BUCKET_NAME")
image =
ExAws.S3.put_object(bucket_name, upload_url, image_binary)
|> ExAws.request!()