papakay

papakay

Bucket name is added to the storage path in digitaolcean space

Please i’m having issue with the file uploaded on the digitalocean space. The bucket bucket name is included in the key of the file stored.

ex_aws 2.0
ex_aws 2.0

Please see a sample response
{:ok, %{ body: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><CompleteMultipartUploadResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Location>afribary-test.ams3.digitaloceanspaces.com</Location><Bucket>afribary-test</Bucket><Key>afribary-test/enterprise/spentary/logo-spentary-1526017375612733000.jpg</Key><ETag>32458d84455d0feda12a654fd41cff3a-1</ETag></CompleteMultipartUploadResult>", headers: [ {"x-amz-request-id", "tx00000000000000100a6d8-005af52d63-4b4052-ams3a"}, {"Content-Type", "application/xml"}, {"Content-Length", "370"}, {"Date", "Fri, 11 May 2018 05:42:59 GMT"}, {"Strict-Transport-Security", "max-age=15552000; includeSubDomains; preload"} ], status_code: 200 }}

I want to be able to access the file without /bucket-name:

https://afribary-test.ams3.digitaloceanspaces.com/enterprise/spentary/logo-spentary-1526016173276296000.png
but i got this
https://afribary-test.ams3.digitaloceanspaces.com/afribary-test/enterprise/spentary/logo-spentary-1526016173276296000.png
def upload(filename, space_path_without_bucket_name) do
    filename
    |> ExAws.S3.Upload.stream_file()
    |> ExAws.S3.upload(@bucket, space_path_without_bucket_name)
    |> ExAws.request()
  end

Marked As Solved

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Ah on the github issue you have:

host: "afribary-test.ams3.digitaloceanspaces.com",

Don’t include the bucket in the hostname, instead do host: "ams3.digitaloceanspaces.com",

Also Liked

papakay

papakay

The document states that DigitalOcean Spaces is AWS Compatible. A colleague was able to upload to the object store successfully without this issue using the php/laravel sdk.

So i’m wondering why this happening with elixir sdk.

papakay

papakay

Awesome! Thank you so much.

This solved it! I’m so grateful!

Where Next?

Popular in Questions Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&amp;query=perfume&amp;page=2, I would like to get: ...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: &lt;h1&gt;Create Post&lt;/h1&gt; &lt;%= ...
New
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 43487 311
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31013 112
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54120 245
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement