Skip to content

Improve exception when no credentials are found #102

@omus

Description

@omus

If you attempt to use aws_config() where there are no credentials setup you get a confusing error message:

ERROR: LoadError: LoadError: IOError(Base.IOError("connect: connection timed out (ETIMEDOUT)", -110) during request(http://169.254.169.254/latest/meta-data/iam/info))

Stacktrace:
 [1] wait_connected(::Sockets.TCPSocket) at /buildworker/worker/package_linux32/build/usr/share/julia/stdlib/v1.3/Sockets/src/Sockets.jl:520
 [2] connect at /buildworker/worker/package_linux32/build/usr/share/julia/stdlib/v1.3/Sockets/src/Sockets.jl:555 [inlined]
 [3] connect at /buildworker/worker/package_linux32/build/usr/share/julia/stdlib/v1.3/Sockets/src/Sockets.jl:541 [inlined]
 [4] #getconnection#14(::Bool, ::Int32, ::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:require_ssl_verification, :iofunction, :verbose),Tuple{Bool,Nothing,Int32}}}, ::typeof(HTTP.ConnectionPool.getconnection), ::Type{Sockets.TCPSocket}, ::SubString{String}, ::SubString{String}) at /home/omus/.julia/packages/HTTP/lZVI1/src/ConnectionPool.jl:568
 [5] #getconnection at ./none:0 [inlined]
 [6] #getconnection#11(::Int32, ::Int32, ::Int32, ::Int32, ::Bool, ::Base.Iterators.Pairs{Symbol,Union{Nothing, Int32},Tuple{Symbol,Symbol},NamedTuple{(:iofunction, :verbose),Tuple{Nothing,Int32}}}, ::typeof(HTTP.ConnectionPool.getconnection), ::Type{HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}, ::SubString{String}, ::SubString{String}) at /home/omus/.julia/packages/HTTP/lZVI1/src/ConnectionPool.jl:517
 [7] (::HTTP.ConnectionPool.var"#kw##getconnection")(::NamedTuple{(:reuse_limit, :iofunction, :verbose, :require_ssl_verification),Tuple{Int32,Nothing,Int32,Bool}}, ::typeof(HTTP.ConnectionPool.getconnection), ::Type{HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}, ::SubString{String}, ::SubString{String}) at ./none:0
 [8] #request#1(::Nothing, ::Type, ::Int32, ::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:iofunction, :verbose, :require_ssl_verification),Tuple{Nothing,Int32,Bool}}}, ::typeof(HTTP.request), ::Type{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}, ::HTTP.URIs.URI, ::HTTP.Messages.Request, ::Array{UInt8,1}) at /home/omus/.julia/packages/HTTP/lZVI1/src/ConnectionRequest.jl:41
 [9] (::HTTP.var"#kw##request")(::NamedTuple{(:iofunction, :verbose, :require_ssl_verification),Tuple{Nothing,Int32,Bool}}, ::typeof(HTTP.request), ::Type{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}, ::HTTP.URIs.URI, ::HTTP.Messages.Request, ::Array{UInt8,1}) at ./none:0
 [10] #request#1(::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:iofunction, :verbose, :require_ssl_verification),Tuple{Nothing,Int32,Bool}}}, ::typeof(HTTP.request), ::Type{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}}, ::HTTP.URIs.URI, ::Vararg{Any,N} where N) at /home/omus/.julia/packages/HTTP/lZVI1/src/ExceptionRequest.jl:19
 [11] #request at ./none:0 [inlined]
 [12] #request#1(::VersionNumber, ::String, ::Nothing, ::Nothing, ::Base.Iterators.Pairs{Symbol,Integer,Tuple{Symbol,Symbol},NamedTuple{(:verbose, :require_ssl_verification),Tuple{Int32,Bool}}}, ::typeof(HTTP.request), ::Type{HTTP.MessageRequest.MessageLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at /home/omus/.julia/packages/HTTP/lZVI1/src/MessageRequest.jl:51
 [13] (::HTTP.var"#kw##request")(::NamedTuple{(:verbose, :require_ssl_verification),Tuple{Int32,Bool}}, ::typeof(HTTP.request), ::Type{HTTP.MessageRequest.MessageLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at ./none:0
 [14] http_request(::Dict{Symbol,Any}) at /home/omus/.julia/packages/AWSCore/nRYAp/src/http.jl:42
 [15] http_get(::String) at /home/omus/.julia/packages/AWSCore/nRYAp/src/http.jl:80
 [16] macro expansion at /home/omus/.julia/packages/Mocking/hFQQ4/src/mock.jl:29 [inlined]
 [17] _ec2_metadata(::String) at /home/omus/.julia/packages/AWSCore/nRYAp/src/AWSCredentials.jl:263
 [18] ec2_instance_credentials() at /home/omus/.julia/packages/AWSCore/nRYAp/src/AWSCredentials.jl:282
 [19] #AWSCredentials#3(::Nothing, ::Type{AWSCore.AWSCredentials}) at /home/omus/.julia/packages/AWSCore/nRYAp/src/AWSCredentials.jl:146
 [20] Type at ./none:0 [inlined]
 [21] aws_config() at /home/omus/.julia/packages/AWSCore/nRYAp/src/AWSCore.jl:115
...

This seems not very user friendly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions