dotnet / dotnet/MQTTnet

NotSupportedException: Extended authentication handler is not yet supported

Open
#1,805 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
5.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug
While connecting to emqx we often get the "Extended authentication handler is not yet supported" exception. My [library](https://github.com/BEagle1984/silverback) automatically retries after 500ms and it eventually successfully connects.
Of course, no setting is being changed in between the retries.

### Which component is your bug related to?
- Client

### To Reproduce
Steps to reproduce the behavior:
1. Using MQTTnet 4.2.1.781
2. Try to connect to EMQX from a couple of pods running on AWS EKS.
3. The first try often fails with a `NotSupportedException` (_Extended authentication handler is not yet supported_)

### Expected behavior
The connection always succeeds.

### Additional context / logging

This is the exception we get:
```batch
MQTTnet.Adapter.MqttConnectingFailedException: Error while authenticating. Extended authentication handler is not yet supported
---> System.NotSupportedException: Extended authentication handler is not yet supported
at MQTTnet.Client.MqttClient.Authenticate(IMqttChannelAdapter channelAdapter, MqttClientOptions options, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at MQTTnet.Client.MqttClient.Authenticate(IMqttChannelAdapter channelAdapter, MqttClientOptions options, CancellationToken cancellationToken)
at MQTTnet.Client.MqttClient.ConnectInternal(IMqttChannelAdapter channelAdapter, CancellationToken cancellationToken)
at MQTTnet.Client.MqttClient.ConnectAsync(MqttClientOptions options, CancellationToken cancellationToken)
at MQTTnet.Client.MqttClient.ConnectAsync(MqttClientOptions options, CancellationToken cancellationToken)
at Silverback.Messaging.Broker.Mqtt.MqttClientWrapper.TryConnectClientAsync(Boolean isFirstTry, CancellationToken cancellationToken)
```

It's not thrown for all clients instantiated within the same application and not always for the same ones.

### Code example

The actual code uses [Silverback](https://github.com/BEagle1984/silverback), which wraps MQTTnet. The resulting MQTTnet related code is something like this:
```csharp
IMqttClient mqttClient = MqttFactory.CreateClient();
await mqttClient.ConnectAsync(options, cancellationToken);
```

The options passed look like this:
```batch
{MQTTnet.Client.MqttClientOptions}
AllowPacketFragmentation: true
AuthenticationData: null
AuthenticationMethod: null
ChannelOptions: {mqtt:1883}
CleanSession: true
ClientId: "Xyz_Xyz_9a3c0f23-70e7-43f2-b266-907fafb19371"
Credentials: {MQTTnet.Client.MqttClientCredentials}
ExtendedAuthenticationExchangeHandler: null
KeepAlivePeriod: {00:00:15}
MaximumPacketSize: 0
ProtocolVersion: V500
ReceiveMaximum: 0
RequestProblemInformation: true
RequestResponseInformation: false
SessionExpiryInterval: 0
ThrowOnNonSuccessfulConnectResponse: true
Timeout: {00:01:40}
TopicAliasMaximum: 0
TryPrivate: true
UserProperties: {Count = 0}
ValidateFeatures: true
WillContentType: null
WillCorrelationData: null
WillDelayInterval: 0
WillMessageExpiryInterval: 0
WillPayload: null
WillPayloadFormatIndicator: Unspecified
WillQualityOfServiceLevel: AtMostOnce
WillResponseTopic: null
WillRetain: false
WillTopic: null
WillUserProperties: {Count = 0}
WriterBufferSize: 4096
WriterBufferSizeMax: 65535
```

The guid in the ClientId is the Kubernetes pod id.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.