peburrows / goth

Elixir package for Oauth authentication via Google Cloud APIs
http://hexdocs.pm/goth
MIT License
289 stars 111 forks source link

Configurable timeout calling google oauth #23

Closed alex88 closed 3 years ago

alex88 commented 7 years ago

Today I was having strange issues with a container running on GKE, when trying to upload an image using https://github.com/martide/arc_gcs every request was throwing this error:

  ** (MatchError) no match of right hand side value: {:error, %HTTPoison.Error{id: nil, reason: :connect_timeout}}
      (goth) lib/goth/client.ex:53: Goth.Client.get_access_token/2
      (goth) lib/goth/token.ex:94: Goth.Token.retrieve_and_store!/1
      lib/arc/storage/gcs.ex:79: Arc.Storage.GCS.get_token/0
      lib/arc/storage/gcs.ex:113: Arc.Storage.GCS.default_headers/0
      lib/arc/storage/gcs.ex:61: Arc.Storage.GCS.do_put/4
      (elixir) lib/task/supervised.ex:85: Task.Supervised.do_apply/2
      (elixir) lib/task/supervised.ex:36: Task.Supervised.reply/5
      (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3

is the timeout for httpoison on goth configurable? Also, it seems pretty strange that I got timeouts since it was a request within google datacenter, after restarting the container everything worked correctly

wojtekmach commented 3 years ago

Closing in favour or #82. On master you can set :http_opts, but soon we'd have a way to swap http clients.