[ErrorCodeNotLeader] the request needing a leader node was executed on a follower node
When I try to create a persistent subscription locally with docker, it works fine. However, when I try to connect to a cluster that I have deployed in staging I receive the above error.
We are using an ESDB cluster with DNS. Is there anything specific in terms of configuration that I could be missing which is causing this to not find the leader node? I have RequiresLeader
set to true
in the go client library.
ex.
func (s *subscription) CreateSubscription(ctx context.Context, resultPrefix string) error {
options := esdb.PersistentAllSubscriptionOptions{
Filter: &esdb.SubscriptionFilter{
Type: esdb.StreamFilterType,
Prefixes: []string{resultPrefix},
},
RequiresLeader: true,
}
return s.EventStore.client.CreatePersistentSubscriptionToAll(ctx, s.SubscriptionGroup, options)
}
Any advice is appreciated. Thank you