Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timeout error when listing S3 buckets using erlcloud

I'm trying to use the erlcloud library for S3 uploads in my app. As a test, I'm trying to get it to list buckets via an iex console:

iex(4)> s3 = :erlcloud_s3.new("KEY_ID", "SECRET_KEY")
...
iex(5)> :erlcloud_s3.list_buckets(s3)
** (ErlangError) erlang error: {:aws_error, {:socket_error, :timeout}}
    (erlcloud) src/erlcloud_s3.erl:909: :erlcloud_s3.s3_request/8
    (erlcloud) src/erlcloud_s3.erl:893: :erlcloud_s3.s3_xml_request/8
    (erlcloud) src/erlcloud_s3.erl:238: :erlcloud_s3.list_buckets/1

I've checked that inets, ssl, and erlcoud are all started, and I know the credentials work fine, because I've tested them in a similar fashion with a Ruby library in irb.

I've tried configuring it with a longer timeout, but no matter how high I set it I still get this error.

Any ideas? Or approaches I could take to debug this?

like image 321
Louis Simoneau Avatar asked Feb 13 '23 09:02

Louis Simoneau


1 Answers

I could simulate the same error, and could resolve it by replacing double-quote with single-quote.

> iex(4)> s3 = :erlcloud_s3.new('KEY_ID', 'SECRET_KEY')
> iex(5)> :erlcloud_s3.list_buckets(s3)

Assuming the double-quote was used, it may be caused by a type mismatch between string and char-list.

like image 174
parroty Avatar answered Feb 14 '23 22:02

parroty