Closed nmattia closed 8 months ago
Hi @nmattia.
The main reason you are getting this is because you do not handle the following error:
a, err := agent.New(config)
if err != nil {
log.Fatal(err)
}
This will return the following if it can not reach the replica:
Get "http://localhost:4943/api/v2/status": dial tcp [::1]:4943: connect: connection refused
The invalid memory address or nil pointer dereference
is because the variable a
(Agent) will be nil
, since it returned an error.
Completely missed this, thank you! Sorry for the noise.
Expected Behavior
If the replica cannot be reached, I would expect a network error or a custom error, not a segfault
Actual Behavior
Steps to Reproduce the Problem
Adapt the README example to use a local replica, and make sure the replica is not running on that port:
Specifications