Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetstream K/V bucket fails due to consumer name not being durable #1321

Closed
alecholmez opened this issue Jun 15, 2023 · 3 comments · Fixed by #1325
Closed

Jetstream K/V bucket fails due to consumer name not being durable #1321

alecholmez opened this issue Jun 15, 2023 · 3 comments · Fixed by #1325
Assignees
Labels
bug Confirmed reproducible bug

Comments

@alecholmez
Copy link

Defect

Provided these code snippets:

	kv, err := jetstream.KeyValue("foo")
	switch {
	case errors.Is(err, nats.ErrBucketNotFound):
		return jetstream.CreateKeyValue(&nats.KeyValueConfig{
			Bucket:      "foo",
			Description: "foobar",
		})

	stuff, err := s.kv.Keys()
	switch {
	// If we find that theres no keys then init is a no-op
	case errors.Is(err, nats.ErrNoKeysFound):
		return nil
	case err != nil:
		return err
	}

I receive the following error:

nats: consumer expected to be durable but a durable name was not set

Versions of nats.go and the nats-server if one was involved:

Client library version: v1.26.0+. This bug does NOT exist in v1.25.0.

Expected result:

No errors when creating accessing k/v buckets.

Actual result:

The below error:

nats: consumer expected to be durable but a durable name was not set
@alecholmez alecholmez added the bug Confirmed reproducible bug label Jun 15, 2023
@piotrpio piotrpio self-assigned this Jun 15, 2023
@piotrpio
Copy link
Collaborator

I assume the version of nats-server you're using is lower than 2.9.0? If so, there was indeed a bug which caused us to use invalid subject to create the consumer on older server versions when durable was not set. I created a PR to solve this issue - #1325

In the meantime, I would encourage you to switch to newer server release (current is 2.9.18) - there were really a lot of new features and improvements throughout 2.9.x releases!

@gudron
Copy link

gudron commented Jun 20, 2023

same problem @ github.com/nats-io/nats.go v1.27.0
on v1.25.0 - bucket watching works fine

UPD:
server version - 2.8.4

@alecholmez
Copy link
Author

@piotrpio I was actually using server version v2.7.4 so yes you are correct! I bumped to the latest v2.9.18 and the problem was resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed reproducible bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants