diff --git a/changes/41742-fix-my-device-500-fleet-free b/changes/41742-fix-my-device-500-fleet-free new file mode 100644 index 0000000000..6f4fb6e0f0 --- /dev/null +++ b/changes/41742-fix-my-device-500-fleet-free @@ -0,0 +1 @@ +- Fixed a crash on the "My device" page for Fleet Free instances. The page returned a 402 error when the host was assigned to a team because the device endpoint called a premium-only API, and also crashed when accessing undefined policies data. diff --git a/frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx b/frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx index e40c5f6a7c..7dc22cbc20 100644 --- a/frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx +++ b/frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx @@ -674,7 +674,7 @@ const DeviceUserPage = ({ ); } - const hasAnyCriticalFailingCAPolicy = host?.policies.some( + const hasAnyCriticalFailingCAPolicy = host?.policies?.some( (p) => p.response === "fail" && p.conditional_access_enabled && p.critical ); diff --git a/server/service/devices.go b/server/service/devices.go index 0f7bcf98a1..c66c1c119a 100644 --- a/server/service/devices.go +++ b/server/service/devices.go @@ -195,7 +195,12 @@ func getDeviceHostEndpoint(ctx context.Context, request interface{}, svc fleet.S if resp.TeamID != nil { // load the team to get the device's team's software inventory config. tm, err := svc.GetTeam(ctx, *resp.TeamID) - if err != nil && !fleet.IsNotFound(err) { + if errors.Is(err, fleet.ErrMissingLicense) { + // Fleet Free does not support teams, so team-specific config + // (software inventory, conditional access, etc.) falls back to + // the global defaults set above. + tm = nil + } else if err != nil && !fleet.IsNotFound(err) { return getDeviceHostResponse{Err: err}, nil } if tm != nil {