ex_aws_s3
ex_aws_s3 copied to clipboard
list_buckets/0 crashes if there are no buckets visible
When made to an account with no buckets:
iex(1)> ExAws.S3.list_buckets |> ExAws.request
** (Protocol.UndefinedError) protocol Enumerable not implemented for nil. This protocol is implemented for: DBConnection.PrepareStream, DBConnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, F
loki.HTMLTree, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Postgrex.Stream, Range, Stream, Timex.Interval
(elixir) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir) lib/enum.ex:141: Enumerable.reduce/3
(elixir) lib/stream.ex:933: Stream.do_enum_transform/7
(elixir) lib/stream.ex:857: Stream.do_transform/5
(sweet_xml) lib/sweet_xml.ex:582: anonymous fn/4 in SweetXml.continuation_opts/2
(xmerl) xmerl_scan.erl:568: :xmerl_scan.scan_document/2
(xmerl) xmerl_scan.erl:291: :xmerl_scan.string/2
(sweet_xml) lib/sweet_xml.ex:237: SweetXml.parse/2
(sweet_xml) lib/sweet_xml.ex:421: SweetXml.xpath/2
(sweet_xml) lib/sweet_xml.ex:451: SweetXml.xpath/3
(sweet_xml) lib/sweet_xml.ex:526: anonymous fn/4 in SweetXml.xmap/3
(elixir) lib/map.ex:791: Map.get_and_update/3
(sweet_xml) lib/sweet_xml.ex:526: SweetXml.xmap/3
(sweet_xml) lib/sweet_xml.ex:525: SweetXml.xmap/3
(ex_aws_s3) lib/ex_aws/s3/parsers.ex:51: ExAws.S3.Parsers.parse_all_my_buckets_result/1
This is due to the XML parser returning nil instead of [], it is ambiguous in the XML.