livehelpnow / ex-rackspace

Elixir library for interfacing with Rackspace Cloud API's
5 stars 12 forks source link

** (KeyError) key :status_code not found in: %HTTPotion.ErrorResponse{message: "req_timedout"} #14

Open thomasdola opened 7 years ago

thomasdola commented 7 years ago

keep getting this error anytime i try to upload.. ** (KeyError) key :status_code not found in: %HTTPotion.ErrorResponse{message: "req_timedout"} any help ?

ewitchin commented 7 years ago

We are looking into this issue. Thank you for reporting!

mjaric commented 7 years ago

Hi @thomasdola Thanks for reporting the issue. I managed to reproduce the issue and it happens some time that authentication timeouts in rare cases. We will update library but it could be breaking change. We need to change return type for some functions which so far didn't return tuple {:ok, result} or {:error, error}.

I will let you know when this is done, and write little breakdown about which functions are changed.

Thank you Milan Jaric

thomasdola commented 7 years ago

thank you.. Another thing i noticed was anytime i start the server it tries to make a request to rackspace. the issue with this is that in case i do not have internet or internet is being slow, it affects everything.. including running test, booting the server... is there any solution to this..? Or is it by design? If yes why? thanks...

mjaric commented 7 years ago

I'm preparing new version which should return {:error, something} for all function calls. So it should help you to decide if you want to teardown your app or not, or repeat same call again, or something else. I doubt that first author of this library had in mind design where it should teardown your app, it is just missed case in code.

thomasdola commented 7 years ago

thanks.. so when can we expect this update?

mjaric commented 7 years ago

Next week.

mjaric commented 7 years ago

@thomasdola this should be fixed now. Could you please give it a try from latest master commit. Please note that error (the timeout) will be bubbled back as return value of any call which fails to complete in given timeframe as %Rackspace.Error{code: 0, message: "req_timedout"} so you can do pattern match with case for instance. If that happens you could either retry with same parameters or let process crash ...

There is one more thing. In case of bad network connectivity, if you are starting application and try to execute any function the error will be probably %Rackspace.Error{code: 0, message: "nxdomain"} if auth could not pass due lack of DNS name resolution. All network related errors have code equal to 0 (zero)

Let me know if latest version works for you so I can close the issue.

Thanks!

thomasdola commented 7 years ago

== Compilation error in file lib/rackspace/api/cloud_files/container.ex == ** (CompileError) lib/rackspace/api/cloud_files/container.ex:35: undefined function base_url/1 (stdlib) lists.erl:1338: :lists.foreach/2 (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6

mjaric commented 7 years ago

Could you please tell me which elixir and erlang version you are using?

thomasdola commented 7 years ago

elixir v1.5.1.1 erlang v20.0.1