I’m having issues with exactly that as well.
I have the following dependencies on my mix.exs
:
{:ex_aws, "~> 2.0"},
{:ex_aws_sqs, "~> 2.0"},
{:ex_aws_sts, "~> 2.0"},
{:configparser_ex, "~> 2.0"}
I have configuration like this (per the ex_aws
README):
config :ex_aws,
debug_requests: true,
region: "sa-east-1",
access_key_id: [{:system, "AWS_ACCESS_KEY_ID"}, {:awscli, "foo-dev", 30}, :instance_role],
secret_access_key: [{:system, "AWS_SECRET_ACCESS_KEY"}, {:awscli, "foo-dev", 30}, :instance_role],
awscli_auth_adapter: ExAws.STS.AuthCache.AssumeRoleCredentialsAdapter,
json_codec: Jason
In my ~/.aws/config
file I have the foo-dev
as a valid profile.
But when trying to, say, receive messages via SQS:
iex(2)> ExAws.SQS.receive_message("MY_QUEUE") |> ExAws.request
[debug] Request URL: "https://sqs.sa-east-1.amazonaws.com/MY_QUEUE"
[debug] Request HEADERS: [{"Authorization", "**REDACTED**"}, {"host", "sqs.sa-east-1.amazonaws.com"}, {"x-amz-date", "20190531T211829Z"}, {"content-type", "application/x-www-form-urlencoded"}]
[debug] Request BODY: "Action=ReceiveMessage"
[warn] ExAws: HTTP ERROR: {:closed, ""}
Turns out that the queue URL is actually wrong (in the AWS dashboard the URL is https://sqs.sa-east-1.amazonaws.com/ROLE_ACCOUNT_ID/MY_QUEUE
)
But still getting the {:error, :closed} from hackney
which I suspect should be a different issue.
Any help would be appreciated