🐛 Current behavior
When I add "?nodePreference=follower" to the connection string, I am not able to read from a follower because of error "NotLeaderError"
const readClient = KurrentDBClient.connectionString`kurrentdb+discover://user:pass@dev-01.com:2113,dev-02.com:2113,dev-03.com:2113?nodePreference=follower`;
const events = readClient.readStream(sourceStream, {
direction: FORWARDS,
fromRevision: START,
resolveLinkTos: true,
maxCount: EVENT_COUNT,
});
cause this error:
/node_modules/@kurrent/kurrentdb-client/dist/utils/convertBridgeError.js:33
return new CommandError_1.NotLeaderError(serviceError);
^
NotLeaderError: NotLeaderError(Endpoint { host: "dev-03.com", port: 2113 })
at convertBridgeError (/node_modules/@kurrent/kurrentdb-client/dist/utils/convertBridgeError.js:33:20)
at convert (/node_modules/@kurrent/kurrentdb-client/dist/streams/readStream.js:53:63)
at async file:///index.js:36:18 {
code: undefined,
_raw: [Error [NotLeaderError]: NotLeaderError(Endpoint { host: "dev-03.com", port: 2113 })] {
metadata: {
'leader-endpoint-host': 'dev-03.com',
'leader-endpoint-port': 2113
}
},
type: 'not-leader',
leader: { address: 'dev-03.com', port: 2113 }
}
and the gossip shows that 3 is indeed the leader even if I asked for the follower:
{
"members": [
{
"instanceId": "b4da8720-57fd-464f-a5fd-8068a0721d45",
"timeStamp": "2025-05-28T16:36:01.5603476Z",
"state": "Leader",
"isAlive": true,
"internalTcpIp": "dev-03.com",
"internalTcpPort": 0,
"internalSecureTcpPort": 1112,
"externalTcpIp": "dev-03.com",
"externalTcpPort": 0,
"externalSecureTcpPort": 1113,
"httpEndPointIp": "dev-03.com",
"httpEndPointPort": 2113,
"lastCommitPosition": 27325351083,
"writerCheckpoint": 27325351391,
"chaserCheckpoint": 27325351391,
"epochPosition": 27318525911,
"epochNumber": 9600,
"epochId": "2926350a-7bb4-45fc-8040-afe60a85faf1",
"nodePriority": 0,
"isReadOnlyReplica": false,
"esVersion": "23.10.1.0"
},
{
"instanceId": "ae2a600e-ed66-4ba3-bc32-bd52c45bc8d1",
"timeStamp": "2025-05-28T16:36:01.5599162Z",
"state": "Follower",
"isAlive": true,
"internalTcpIp": "dev-02.com",
"internalTcpPort": 0,
"internalSecureTcpPort": 1112,
"externalTcpIp": "dev-02.com",
"externalTcpPort": 0,
"externalSecureTcpPort": 1113,
"httpEndPointIp": "dev-02.com",
"httpEndPointPort": 2113,
"lastCommitPosition": 27325351083,
"writerCheckpoint": 27325351391,
"chaserCheckpoint": 27325351391,
"epochPosition": 27318525911,
"epochNumber": 9600,
"epochId": "2926350a-7bb4-45fc-8040-afe60a85faf1",
"nodePriority": 0,
"isReadOnlyReplica": false,
"esVersion": "23.10.1.0"
},
// 01 omitted for message length
],
"serverIp": "dev-03.com",
"serverPort": 2113
}
this is true with or without requiresLeader: false, attribute on stream read.
If I remove the param ?nodePreference=follower the read of the stream works as expected with no issues.
🔍 Steps to reproduce
- setup a cluster with at least a leader and a follower node
- read a stream from a follower node using
?nodePreference=follower parameter in connection stream
- see error "NotLeaderError"
Reproducible link
https://codesandbox.io/p/devbox/kurrentdb-forked-95kjpy
💭 Expected behavior
I am able to read a stream from a follower using ?nodePreference=follower in connection string as indicated in kurrent client documentation at https://docs.kurrent.io/clients/grpc/getting-started.html#connection-string
Package version
KurrentDB-NodeJS-Client 1.0.1
KurrentDB Version
EventstoreDB 23.10
Connection string
kurrentdb+discover://user:pass@dev-01.com:2113,dev-02.com:2113,dev-03.com:2113?nodePreference=follower
☁️ Deployment Environment
Multi-node cluster (Cloud)
Other Deployment Details
No response
Operating system
No response
Code of Conduct
🐛 Current behavior
When I add "?nodePreference=follower" to the connection string, I am not able to read from a follower because of error "NotLeaderError"
cause this error:
and the gossip shows that 3 is indeed the leader even if I asked for the follower:
{ "members": [ { "instanceId": "b4da8720-57fd-464f-a5fd-8068a0721d45", "timeStamp": "2025-05-28T16:36:01.5603476Z", "state": "Leader", "isAlive": true, "internalTcpIp": "dev-03.com", "internalTcpPort": 0, "internalSecureTcpPort": 1112, "externalTcpIp": "dev-03.com", "externalTcpPort": 0, "externalSecureTcpPort": 1113, "httpEndPointIp": "dev-03.com", "httpEndPointPort": 2113, "lastCommitPosition": 27325351083, "writerCheckpoint": 27325351391, "chaserCheckpoint": 27325351391, "epochPosition": 27318525911, "epochNumber": 9600, "epochId": "2926350a-7bb4-45fc-8040-afe60a85faf1", "nodePriority": 0, "isReadOnlyReplica": false, "esVersion": "23.10.1.0" }, { "instanceId": "ae2a600e-ed66-4ba3-bc32-bd52c45bc8d1", "timeStamp": "2025-05-28T16:36:01.5599162Z", "state": "Follower", "isAlive": true, "internalTcpIp": "dev-02.com", "internalTcpPort": 0, "internalSecureTcpPort": 1112, "externalTcpIp": "dev-02.com", "externalTcpPort": 0, "externalSecureTcpPort": 1113, "httpEndPointIp": "dev-02.com", "httpEndPointPort": 2113, "lastCommitPosition": 27325351083, "writerCheckpoint": 27325351391, "chaserCheckpoint": 27325351391, "epochPosition": 27318525911, "epochNumber": 9600, "epochId": "2926350a-7bb4-45fc-8040-afe60a85faf1", "nodePriority": 0, "isReadOnlyReplica": false, "esVersion": "23.10.1.0" }, // 01 omitted for message length ], "serverIp": "dev-03.com", "serverPort": 2113 }this is true with or withoutrequiresLeader: false,attribute on stream read.If I remove the param
?nodePreference=followerthe read of the stream works as expected with no issues.🔍 Steps to reproduce
?nodePreference=followerparameter in connection streamReproducible link
https://codesandbox.io/p/devbox/kurrentdb-forked-95kjpy
💭 Expected behavior
I am able to read a stream from a follower using
?nodePreference=followerin connection string as indicated in kurrent client documentation at https://docs.kurrent.io/clients/grpc/getting-started.html#connection-stringPackage version
KurrentDB-NodeJS-Client 1.0.1
KurrentDB Version
EventstoreDB 23.10
Connection string
kurrentdb+discover://user:pass@dev-01.com:2113,dev-02.com:2113,dev-03.com:2113?nodePreference=follower
☁️ Deployment Environment
Multi-node cluster (Cloud)
Other Deployment Details
No response
Operating system
No response
Code of Conduct