-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Observed behavior
Specifying an authentication type in the client configuration and trying to connect to a server that does not provide a nonce in the INFO message (i.e. is not configured for authentication) raises a fatal error.
Expected behavior
When the NatsClient is configured to use an authentication method and you try connecting to a server that does not configure any auth control (and hence does not provide a nonce in the INFO payload), the client builds and sends the CONNECT as if there is no authentication required.
This should succeed and not crash in a consuming application. The Go and Java clients behave like this expectation, so I would expect the same here for consistency.
Server and client version
nats-server: v2.11.7
nats.swift: 0.4.0 / current trunk (527205c)
Host environment
A nats-server configured with the following:
jetstream: enabled
jetstream {
store_dir: /tmp/nats-playground
max_mem: 1G
max_file: 5G
domain: nats-playground-1
}
websocket {
port: 8888
same_origin: false
no_tls: true
}
Steps to reproduce
- Run nats-server with above config
- Configure
NatsClientBuilderwith any ofcredentialPathornkey(by path or string) - Observe failure on connect with:
error: nats: invalid client configuration: missing nonce