Skip to content

fix(sdk/go): Fallback when tenantID is zero UUID#3349

Merged
gregfurman merged 1 commit intohatchet-dev:mainfrom
gregfurman:fix/config/tenant-id-fallback
Mar 20, 2026
Merged

fix(sdk/go): Fallback when tenantID is zero UUID#3349
gregfurman merged 1 commit intohatchet-dev:mainfrom
gregfurman:fix/config/tenant-id-fallback

Conversation

@gregfurman
Copy link
Collaborator

Description

This PR checks if the supplied Tenant ID is either empty "" or the zero uuid.UUID value 00000000-0000-0000-0000-000000000000 -- where the only the former was being checked which causing tenant IDs not to be extracted from supplied tokens with v1.NewHatchetClient(...) calls.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

What's Changed

  • When a tenant ID is the zero value for a uuid.UUID, this triggers a fallback to extract from the passed in token.

Testing

Using the below client.yaml, run the go script both with and without the change.

token: "<token>"
log:
  level: debug
tls:
  base:
    tlsStrategy: none
package main

import (
	"fmt"
	"os"

	clientloader "github.com/hatchet-dev/hatchet/pkg/client/loader"
	v1 "github.com/hatchet-dev/hatchet/pkg/v1"
)

func main() {
	configBytes, err := os.ReadFile("client.yaml")
	if err != nil {
		panic(err)
	}

	cf, err := clientloader.LoadClientConfigFile(configBytes)
	if err != nil {
		panic(err)
	}

	client, err := v1.NewHatchetClient(v1.Config{
		Token: cf.Token,
		TLS: &v1.TLSConfig{
			Base:          &cf.TLS.Base,
			TLSServerName: cf.TLS.TLSServerName,
		},
	})
	if err != nil {
		panic(err)
	}

	fmt.Printf("TenantID: %s\n", client.V0().TenantId())
}

You'll see HEAD of main return:

TenantID: 00000000-0000-0000-0000-000000000000

with these changes added:

TenantID: 707d0855-80ab-4e1f-a156-f1c4546cbf52 # or whatever tenant ID was used in your token generation

@vercel
Copy link

vercel bot commented Mar 20, 2026

@gregfurman is attempting to deploy a commit to the Hatchet Team on Vercel.

A member of the Team first needs to authorize it.

@gregfurman gregfurman requested a review from mrkaye97 March 20, 2026 15:09
Copy link
Contributor

@mrkaye97 mrkaye97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@gregfurman
Copy link
Collaborator Author

This PR supersedes #3322

@gregfurman gregfurman force-pushed the fix/config/tenant-id-fallback branch from c0473e3 to 3fb0f9d Compare March 20, 2026 15:12
@gregfurman gregfurman merged commit 27d7818 into hatchet-dev:main Mar 20, 2026
49 of 50 checks passed
@gregfurman gregfurman self-assigned this Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants