diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index bdf2d4148cc..35f9beaf635 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -255,7 +255,7 @@ func NewServer(ctx context.Context, config *csconfig.LocalApiServerCfg) (*APISer controller.AlertsAddChan = apiClient.AlertsAddChan - if config.ConsoleConfig.IsPAPIEnabled() { + if config.ConsoleConfig.IsPAPIEnabled() && config.OnlineClient.Credentials.PapiURL != "" { if apiClient.apiClient.IsEnrolled() { log.Info("Machine is enrolled in the console, Loading PAPI Client") @@ -340,7 +340,7 @@ func (s *APIServer) initAPIC(ctx context.Context) { // csConfig.API.Server.ConsoleConfig.ShareCustomScenarios if s.apic.apiClient.IsEnrolled() { - if s.consoleConfig.IsPAPIEnabled() { + if s.consoleConfig.IsPAPIEnabled() && s.papi != nil { if s.papi.URL != "" { log.Info("Starting PAPI decision receiver") s.papi.pullTomb.Go(func() error { return s.papiPull(ctx) })