NatsError: wrong last sequence x
See original GitHub issueI experimented with kv today and implemented the example found in the README.
Somehow, I sometimes get this error. It鈥檚 has definitely to do with the kv store, as I never experienced it before and the error vanishes when I delete the bucket and restart the app. Just restarting the nats server and restarting the app does not resolve the error and it persists after restart.
[Nest] 97974 - 10/15/2022, 6:24:23 PM ERROR [NatsError: wrong last sequence: 65
at checkJsErrorCode (/Users/me/project/node_modules/nats/nats-base-client/jsutil.ts:177:14)
at JetStreamClientImpl.parseJsResponse (/Users/me/project/node_modules/nats/nats-base-client/jsbaseclient_api.ts:106:35)
at JetStreamClientImpl.<anonymous> (/Users/me/project/node_modules/nats/nats-base-client/jsclient.ts:189:21)
at Generator.next (<anonymous>)
at fulfilled (/Users/me/project/node_modules/nats/lib/nats-base-client/jsclient.js:19:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5)] wrong last sequence: 65
Any hints to what this error might point to? I鈥檓 not doing something crazy, just saving some keys into and JsonCodec encoded json into the kv.
This happened a few times now while developing but I didn鈥檛 manage to reproduce it consistently by any means.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
wrong sequence, wanted 5665328 got 5665327 | Big raft.log ...
Running latest nats-streaming version in a clustered configuration with 3 nodes, using individual file stores for persistence.
Read more >nats.ws - UNPKG
257, class NatsError1 extends Error {. 258, constructor(message, code1, chainedError1){. 259, super(message);. 260, this.name = "NatsError";.
Read more >JetStream wire API Reference - NATS Docs
Reference 路 Error Handling 路 Admin API 路 Acknowledging Messages 路 Fetching The Next Message From a Pull-based Consumer 路 Fetching From a...
Read more >/jetstream.md | nats@v1.3.1 | Deno
For example, you can request the message to have as its // last sequence before accepting ... JetStream callbacks look like this: (err:...
Read more >nats - npm
Node.js client for NATS, a lightweight, high-performance cloud native messaging system. Latest version: 2.10.2, last published: 6 days ago.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes you鈥檙e right. I did miss a line of code where I was doing exactly that.
So now I have this:
which prevents the error and it works as intended so far.
Is this the correct way to handle it though or is there maybe a shorter/cleaner version?
Awesome. Thank you so much for the advice! 馃コ