diff --git a/preauth_keys.go b/preauth_keys.go index 11803b5c..7488a2eb 100644 --- a/preauth_keys.go +++ b/preauth_keys.go @@ -86,7 +86,7 @@ func (h *Headscale) checkKeyValidity(k string) (*PreAuthKey, error) { defer db.Close() pak := PreAuthKey{} - if db.First(&pak, "key = ?", k).RecordNotFound() { + if db.Preload("Namespace").First(&pak, "key = ?", k).RecordNotFound() { return nil, errorAuthKeyNotFound }