Facing a similar issue but the leader is permanently - not just a momentary problem - missing/inaccessible.
`juju status` does show there's a leader. But any command issued to `<unit>/leader` fails with:
```
# juju run --unit <unit>/leader 'relation-ids db-router'
ERROR could not determine leader for "<unit>"
```
I looked through the raft logs and it all looks OK.
In the mongoDB, there's no leadership entry in the leaseholders collection at all for the unit that `juju status` says is the leader.
Facing a similar issue but the leader is permanently - not just a momentary problem - missing/ inaccessible.
`juju status` does show there's a leader. But any command issued to `<unit>/leader` fails with:
```
# juju run --unit <unit>/leader 'relation-ids db-router'
ERROR could not determine leader for "<unit>"
```
I looked through the raft logs and it all looks OK.
In the mongoDB, there's no leadership entry in the leaseholders collection at all for the unit that `juju status` says is the leader.