Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no case clause matching TemporaryRedirect error #639

Open
augnustin opened this issue Jun 3, 2019 · 0 comments
Open

no case clause matching TemporaryRedirect error #639

augnustin opened this issue Jun 3, 2019 · 0 comments

Comments

@augnustin
Copy link

Environment

  • Elixir & Erlang versions (elixir --version):
elixir --version
Erlang/OTP 21 [erts-10.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Elixir 1.8.0 (compiled with Erlang/OTP 21)
  • ExAws version mix deps |grep ex_aws
mix deps |grep ex_aws
* ex_aws 2.1.1 (Hex package) (mix)
  locked at 2.1.1 (ex_aws) 1e4de210
* ex_aws_s3 2.0.2 (Hex package) (mix)
  locked at 2.0.2 (ex_aws_s3) c0258bbd
  • HTTP client version. IE for hackney do mix deps | grep hackney
mix deps | grep hackney
  /app/deps/ex_admin/mix.exs:19

* hackney 1.15.1 (Hex package) (rebar3)
  locked at 1.15.1 (hackney) 9f8f471c

Current behavior

This code:

ExAws.S3.put_object(Application.get_env(:ex_aws, :bucket_name), filename, binary)
|> ExAws.request

returns me:

[error] #PID<0.1313.0> running Vae.Endpoint terminated
Server: localhost:4000 (http)
Request: POST /candidatures/2/resume
** (exit) an exception was raised:
    ** (CaseClauseError) no case clause matching: {:ok, %{body: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>TemporaryRedirect</Code><Message>Please re-send this request to the specified temporary endpoint. Continue to use the original request endpoint for future requests.</Message><Endpoint>avril-resumes-local.s3.eu-west-3.amazonaws.com</Endpoint><Bucket>avril-resumes-local</Bucket><RequestId>4D09B977AED3B457</RequestId><HostId>DYergbAa7s6drzINu0dlNK93HwzUAXKGjnIeEUcALX4Az+ZwZDbJ4aL/UbJ8it7p2RKnWGkjXVU=</HostId></Error>", headers: [{"x-amz-bucket-region", "eu-west-3"}, {"x-amz-request-id", "4D09B977AED3B457"}, {"x-amz-id-2", "DYergbAa7s6drzINu0dlNK93HwzUAXKGjnIeEUcALX4Az+ZwZDbJ4aL/UbJ8it7p2RKnWGkjXVU="}, {"Location", "https://avril-resumes-local.s3.eu-west-3.amazonaws.com/avril-resumes-local/8509754b3bce45418305a64a2d4abf9a.pdf"}, {"Content-Type", "application/xml"}, {"Transfer-Encoding", "chunked"}, {"Date", "Mon, 03 Jun 2019 13:32:31 GMT"}, {"Connection", "close"}, {"Server", "AmazonS3"}], status_code: 307}}
        (ex_aws) lib/ex_aws/request.ex:42: ExAws.Request.request_and_retry/7
        (ex_aws) lib/ex_aws/operation/s3.ex:39: ExAws.Operation.ExAws.Operation.S3.perform/2

The actual parameters of the put_object call are fine.

Expected behavior

I checked for the

Please re-send this request to the specified temporary endpoint. Continue to use the original request endpoint for future requests.

and it seems related to region-specific issue along with bucket creation so it may go away by itself.

That said, shouldn't the lib handle the case so that the issue goes up to application code instead of triggering a no case clause matching error at lib level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant