ex_aws
ex_aws copied to clipboard
Any way to overcome <service> not supported in region <region> for partition aws?
Environment
- Elixir & Erlang versions (elixir --version):
Erlang/OTP 20 [erts-9.3.3.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [kernel-poll:false]
Elixir 1.9.4 (compiled with Erlang/OTP 20)
- ExAws version
mix deps |grep ex_aws
* ex_aws 2.1.1 (Hex package) (mix)
locked at 2.1.1 (ex_aws) 06b6fde1`
- HTTP client version. IE for hackney do
mix deps | grep hackney
* hackney 1.15.1 (Hex package) (rebar3)
locked at 1.15.1 (hackney) c2790c9f
Current behavior
Currently, whenever we are trying to use a service that are supported AWS but not included in priv/endpoints.exs
, we will faced the (RuntimeError) <service> not supported in region <region>...
. For example:
ExAws.Operation.JSON.new(:sagemaker_runtime, %{
http_method: :post,
path: "/endpoint/model-name/invocations",
data: "{\"id\":\"271dcf6e-7fff-46d0-847a-f1add6b7bbeb\",\"image_url\":\"http://example.com/image.jpg\"}",
headers: [{"content-type", "application/json"}]
}) |> ExAws.request!()
will raise:
** (RuntimeError) sagemaker_runtime not supported in region ap-southeast-1 for partition aws
(ex_aws) lib/ex_aws/config/defaults.ex:140: ExAws.Config.Defaults.fetch_or/3
(ex_aws) lib/ex_aws/config/defaults.ex:123: ExAws.Config.Defaults.do_host/3
(ex_aws) lib/ex_aws/config/defaults.ex:60: ExAws.Config.Defaults.get/2
(ex_aws) lib/ex_aws/config.ex:47: ExAws.Config.build_base/2
(ex_aws) lib/ex_aws/config.ex:34: ExAws.Config.new/2
(ex_aws) lib/ex_aws.ex:50: ExAws.request/2
(ex_aws) lib/ex_aws.ex:61: ExAws.request!/2
Expected behavior
Is there anyway to overcome this (without forking and editing priv/endpoints.exs
)? Pinpointing me to the right direction would be sufficient.
Would also willing to contribute if there is any plan for long term fixes.
Anyway, thanks for making this library 💯
Indeed @kw7oe, There should be a way to bypass it when the developer knows the region exists and that the service supports it.
Either by a bypass_checks: true
or just bypass it completely when the host doesn't have an amazon-specific domain.
These checks basically ruins an easy addition of a third-party provider such as DO or Backblaze.
Remember, though, that the endpoints file doesn't just check for the existence of a service/location but also contains any specific configuration for it. Having said that, I'm aware it's a pain since, besides anything else, AWS is constantly adding stuff.
I think a better solution might be to allow runtime patching of the endpoint data so that you don't have to wait for version updates if you know something is available. I'd be more than happy to consider a patch for that.
So the solution is only to fork ? Or wait for new releases ?