From 9ce8dc3fb62a9ee4ab4c5c720f58611aa831d23f Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Thu, 6 May 2021 00:59:16 +0200 Subject: [PATCH] Preload the namespace --- preauth_keys.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 }