ex-aws / ex_aws

A flexible, easy to use set of clients AWS APIs for Elixir

Home Page:https://hex.pm/packages/ex_aws

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CaseClauseError: no case clause matching: {:error, "timeout"} in ExAws.Request.request_and_retry/7

ryanbrainard opened this issue · comments

Environment

  • Elixir & Erlang versions (elixir --version):
$ elixir --version
Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit:ns]

Elixir 1.15.4 (compiled with Erlang/OTP 26)
  • ExAws version mix deps |grep ex_aws
$ mix deps |grep ex_aws
* ex_aws 2.4.4 (Hex package) (mix)
  locked at 2.4.4 (ex_aws) a7d63e48
* ex_aws_acm 1.0.1 (Hex package) (mix)
  locked at 1.0.1 (ex_aws_acm) cd1bdcb3
* ex_aws_kinesis 2.0.1 (Hex package) (mix)
  locked at 2.0.1 (ex_aws_kinesis) 7ba0e467
* ex_aws_kms 2.2.0 (Hex package) (mix)
  locked at 2.2.0 (ex_aws_kms) 9797e292
* ex_aws_s3 2.4.0 (Hex package) (mix)
  locked at 2.4.0 (ex_aws_s3) 85dda6e2
* ex_aws_secretsmanager 2.0.0 (Hex package) (mix)
  locked at 2.0.0 (ex_aws_secretsmanager) 8b2838af
* ex_aws_sts 2.3.0 (Hex package) (mix)
  locked at 2.3.0 (ex_aws_sts) f14e4c7d
  • HTTP client version. IE for hackney do mix deps | grep hackney
$ mix deps | grep tesla
* opentelemetry_tesla 2.2.0 (Hex package) (mix)
  locked at 2.2.0 (opentelemetry_tesla) 4cad0380
* tesla 1.7.0 (Hex package) (mix)
  locked at 1.7.0 (tesla) 2e64f01e

Current behavior

Include code samples, errors and stacktraces if appropriate.

When calling ExAws.request/2 (in this case with ExAws.SecretsManager.create_secret/4 operation) and a timeout occurs, ExAws.Request.request_and_retry/7 does not have a matching case statement, so fails:

CaseClauseError: no case clause matching: {:error, "timeout"}
ExAws.Request.request_and_retry/7 (ex_aws)(lib/ex_aws/request.ex:38)

ExAws.Operation.ExAws.Operation.JSON.perform/2 (ex_aws)(lib/ex_aws/operation/json.ex:50)

MyApp.EnvVar.create_secret_in_aws/4 (myapp)(lib/myapp/instances/env_var.ex:172)

Note, these timeouts are rare and transient. This same app code works 100s of times a day, but occasionally like this apparently from either a network or AWS failure.

Expected behavior

I would expect timeouts to either be retried or gracefully return an error.

Looking at past occurances, this error also happens for CaseClauseError no case clause matching: {:error, "socket closed"} in the same location. It would be good to fix both of these together.