fix(temporal): let SDK handle TLS when using API key auth#7462
fix(temporal): let SDK handle TLS when using API key auth#7462rohansood10 wants to merge 1 commit intokedacore:mainfrom
Conversation
When using API key authentication with Temporal Cloud, KEDA was explicitly creating a TLS config and passing it to the Temporal SDK. This overrode the SDK's built-in auto-TLS behavior for API key auth, causing 'tls: certificate required' errors because the explicit config lacked the client certificate that Temporal Cloud's mTLS endpoint expects. The Temporal Go SDK (since temporalio/sdk-go#2126) auto-enables TLS with the correct configuration when an API key is provided and TLS is not explicitly set. By only creating an explicit TLS config when the user has provided custom TLS settings (CA cert, server name, or unsafeSsl), we allow the SDK to handle the standard Temporal Cloud case correctly. Fixes kedacore#7443 Signed-off-by: rohansood10 <rohansood10@users.noreply.github.com>
|
Thank you for your contribution! 🙏 Please understand that we will do our best to review your PR and give you feedback as soon as possible, but please bear with us if it takes a little longer as expected. While you are waiting, make sure to:
Once the initial tests are successful, a KEDA member will ensure that the e2e tests are run. Once the e2e tests have been successfully completed, the PR may be merged at a later date. Please be patient. Learn more about our contribution guide. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
@cheelim1 I see from the description that you want to test this. If so, will you create a build yourself to test it? Or would you like me to create one for you? Thanks 🙂 |
|
@rickbrouwer i will build it myself and test it. |
Description
Fixes the recurring 'tls: certificate required' error when connecting to Temporal Cloud using API key authentication.
Root Cause
When
apiKeyis provided, KEDA explicitly creates a TLS config viaCreateTLSClientConfig()and passes it to the Temporal SDK. This overrides the SDK's built-in auto-TLS behavior for API key auth. The Temporal Go SDK (since temporalio/sdk-go#2126) auto-enables TLS with the correct configuration when an API key is provided and TLS is not explicitly set/disabled.By explicitly setting a TLS config, KEDA was preventing the SDK from applying its own Temporal Cloud-compatible TLS settings, resulting in the server rejecting the connection because no client certificate was presented.
Fix
Only create an explicit TLS config when the user has provided custom TLS settings (CA cert, server name, or unsafeSsl). For the standard API key auth case, let the SDK handle TLS automatically.
Testing
All existing Temporal scaler tests pass. This fix requires integration testing with Temporal Cloud (API key auth) to fully validate — @cheelim1 has previously offered to test builds.
Checklist
make generate-scalers-schemahas been run to update any outdated generated filesFixes #7443
Related: #7343, #6865