-
Notifications
You must be signed in to change notification settings - Fork 699
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
With a NATS server with JetStream disabled jetstream
package functions always returns context deadline exceeded
#1565
Comments
Hello @johbar , thank you for submitting the issue. I'll take a look at this. |
Ok, so I looked at this issue and this is caused by the the fact that the nats docker image by default starts in clustered mode: https://hub.docker.com/_/nats In clustered mode, server behaves differently then in standalone mode - it will not return "JetStream not enabled" to the client because there may be another server in the cluster with JetStream enabled. Since there is none, the request eventually times out and thus context deadline exceeded error. There is not much that can be done about this unfortunately. If you don't need clustered JetStream, you may want to consider using a standalone server instead and get proper errors. |
Hi @piotrpio, thank you for that investigation. I considered opening another issue requesting something like a Nevertheless, it is a bit unsatisfying if we only get a timeout, especially in a rather static clustered setup, that could, for whatever reason, be misconfigured. But if it is not possible to return a more specific error, I think at least some docs should be revised. Like ErrJetStreamNotEnabled should have a hint when not to expect that error. Also the AccountInfo comment should be clear about that. |
You're right, I'll update the docs to make it clear 👍 |
I've updated the docs. |
Observed behavior
When starting a NATS server with JetStream disabled, the
jetstream
package client operations always seem to returncontext.deadlineExceededError
instead of specialized errors.Expected behavior
Functions like
AccountInfo(ctx context.Context)
should returnErrJetStreamNotEnabled
.Server and client version
github.com/nats-io/nats.go v1.33.1
server version 2.10.11
Host environment
go version go1.22.0 linux/amd64
Server running on Podman v4.8.3
Steps to reproduce
Start Server with
podman run --rm -it -p 4222:4222 nats:latest
.Quick and dirty client code:
Output:
I also tried to unwrap and convert the error with no success.
The text was updated successfully, but these errors were encountered: