Skip to content

Commit 0e04305

Browse files
authored
Bug fix: Do not call CheckHealth when authenticating with API keys (#232)
<!--- Note to EXTERNAL Contributors --> <!-- Thanks for opening a PR! If it is a significant code change, please **make sure there is an open issue** for this. We work best with you when we have accepted the idea first before you code. --> <!--- For ALL Contributors 👇 --> ## What was changed - WISOTT - Note: This bug fix was an unfortunate regression that was introduced with [this](#203). This intends on fixing that. ## Why? - Bug fix! ## Checklist <!--- add/delete as needed ---> 1. Closes <!-- add issue number here --> 2. How was this tested: <!--- Please describe how you tested your changes/how we can test them --> 3. Any docs updates needed? <!--- update README if applicable or point out where to update docs.temporal.io -->
1 parent 5c76231 commit 0e04305

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

internal/controller/clientpool/clientpool.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,15 @@ func (cp *ClientPool) DialAndUpsertClient(clientOpts sdkclient.Options, clientPo
261261
return nil, err
262262
}
263263

264-
if _, err := c.CheckHealth(context.Background(), &sdkclient.CheckHealthRequest{}); err != nil {
265-
c.Close()
266-
return nil, fmt.Errorf("temporal server health check failed: %w", err)
264+
// Skip health check for API key auth — CheckHealth is a system-level
265+
// (non-namespace-scoped) RPC that fails with namespace-scoped API keys
266+
// on Temporal Cloud. This is safe because client.Dial already calls
267+
// GetSystemInfo internally, which is a superset of CheckHealth.
268+
if clientAuth.mode != AuthModeAPIKey {
269+
if _, err := c.CheckHealth(context.Background(), &sdkclient.CheckHealthRequest{}); err != nil {
270+
c.Close()
271+
return nil, fmt.Errorf("temporal server health check failed: %w", err)
272+
}
267273
}
268274

269275
cp.mux.Lock()

0 commit comments

Comments
 (0)