DynamoDB problem with ExAWS when running tests

I’m using ExAws and using the Dynamo module. While in the documentation it says that when running in dev and test mode, it uses a “local dynamo” instance but when I run the tests it tries to connect to my dynamo instance live. Not sure if I’m missing something from docs but I believe this shouldn’t happen right?

The error message

    (ex_aws) lib/ex_aws/instance_meta.ex:26: ExAws.InstanceMeta.request/2
    (ex_aws) lib/ex_aws/instance_meta.ex:58: ExAws.InstanceMeta.instance_role_credentials/1
    (ex_aws) lib/ex_aws/instance_meta.ex:64: ExAws.InstanceMeta.security_credentials/1
    (ex_aws) lib/ex_aws/config/auth_cache.ex:58: ExAws.Config.AuthCache.refresh_config/2
    (ex_aws) lib/ex_aws/config/auth_cache.ex:33: ExAws.Config.AuthCache.handle_call/3
    (stdlib) gen_server.erl:636: :gen_server.try_handle_call/4
    (stdlib) gen_server.erl:665: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.374.0>): {:refresh_config, %{access_key_id: [{:system, "AWS_ACCESS_KEY_ID"}, :instance_role], host: {"$region", "dynamodb.$region.amazonaws.com"}, http_client: ExAws.Request.Hackney, json_codec: Poison, port: 443, region: "us-east-1", retries: [max_attempts: 10, base_backoff_in_ms: 10, max_backoff_in_ms: 10000], scheme: "https://", secret_access_key: [{:system, "AWS_SECRET_ACCESS_KEY"}, :instance_role]}}

The instance meta check is happening because you don’t have properly configured AWS keys, not because it’s trying to connect to the live Dynamo.

1 Like