-
Notifications
You must be signed in to change notification settings - Fork 868
Description
Describe the bug
After upgrading AWSSDK.SecurityToken to version 4.x, we began encountering sporadic errors from the Kafka brokers with the message: Invalid authentication payload. These errors occur intermittently, typically every 5 to 30 minutes, a few times per day.
We have since reverted to AWSSDK version 3.x, which resolves the issue for now.
I’m currently in contact with AWS Support, and they recommended that I post the issue here as well. Additionally, I couldn’t find any relevant information in the migration docs.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
There are no authentication failures logged, nor any documentation explaining what changes are required to avoid these exceptions.
Current Behavior
Exception:
/bootstrap: SASL authentication error: [53fb19f7-525a-47e4-a7cd-9b7bed03310c]: Invalid authentication payload (after 101ms in state AUTH_REQ)
Reproduction Steps
Upgrade
<PackageReference Include="AWS.MSK.Auth" Version="1.0.0" />
<PackageReference Include="AWSSDK.Glue" Version="3.7.408.2" />
To
<PackageReference Include="AWS.MSK.Auth" Version="1.1.1" />
<PackageReference Include="AWSSDK.Glue" Version="4.0.16.2" />
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.2.2" />
Possible Solution
No response
Additional Information/Context
OAuthCallback method:
public void OAuthCallback(IClient client, string principalName)
{
try
{
// Warning: These are blocking calls. We cannot use async/await here due to Confluent.Kafka limitations.
(string token, long expiryMs) = _mskTokenGenerator.GenerateAuthTokenAsync(Amazon.RegionEndpoint.EUWest1).Result;
client.OAuthBearerSetToken(token, expiryMs, principalName);
}
#pragma warning disable CA1031 // Do not catch general exception types
catch (Exception ex)
#pragma warning restore CA1031
{
client.OAuthBearerSetTokenFailure(ex.ToString());
}
}
Consumer builder:
return new ConsumerBuilder<string, TMessageValue>(consumerConfig)
.SetOAuthBearerTokenRefreshHandler((client, _) => oAuthService.OAuthCallback(client, principalName))
.SetKeyDeserializer(Deserializers.Utf8)
.SetValueDeserializer(valueDeserializer)
.Build();
AWS .NET SDK and/or Package version used
<PackageReference Include="AWS.MSK.Auth" Version="1.1.1" />
<PackageReference Include="AWSSDK.Glue" Version="4.0.16.2" />
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.2.2" />
Targeted .NET Platform
.NET 8.0
Operating System and version
Linux