1stSolo

1stSolo

A frustrating issue with ex_aws get_bucket_lifecycle

Having a frustrating issue with S3 API. Pretty much all functional calls I tried so far always return json response, which get happily translated into elixir maps and lists by Jason (thanks to

config :ex_aws, json_codec: Jason

option).
But one particular API, get_bucket_lifecycle(), returns XML. Jason then messes up the data because it thinks it’s json.
I tried adding

request = request |> struct(%{headers: Map.merge(request.headers, %{“Accept” => “application/json”})})

to force json but it had no effect.
I also tried aws s3api get-bucket-lifecycle-configuration --bucket cogynt-data --debug to see what amazon’s own tool is doing, and I’m seeing in debug output that the raw response from server is actually XML, and then they use Python’s boto to read XML into structs which then get output as json to the client.
I know there must be a reason ex_aws has a dependency on :sweet_xml library, but I’m also concerned that it’s using the outdated API, get_bucket_lifecycle instead of get-bucket-lifecycle-configuration and than I’m seemingly unable to get an elixir map/list on the output.
Any tips are much appreciated.

Most Liked

Schultzer

Schultzer

I think you are better of in the long term by using a generated client like: GitHub - aws-beam/aws-elixir: AWS clients for Elixir · GitHub.

AFAIK ex_aws hasn’t been maintained in a while, aws-elixir will feel a little bit lower level, but you will have more control.

Where Next?

Popular in Questions Top

siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
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
dotdotdotPaul
Okay, I’m having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I’m sure I’...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39297 209
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement