Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] api/fleet/agents returning 500 when component field has format different than expected #213423

Closed
criamico opened this issue Mar 6, 2025 · 2 comments
Labels
bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@criamico
Copy link
Contributor

criamico commented Mar 6, 2025

Kibana version:
8.16.2 and above

Describe the bug:

User in cloud has a job which exports agent statistics running this query:

api/fleet/agents?perPage=9999&withMetrics=false&showInactive=true&getStatusSummary=true&kuery=%28not+policy_id%3A+policy-elastic-agent-on-cloud+and+not+status+%3A+unenrolled%29

Sometimes this fails with error

`{"statusCode":500,"error":"Internal Server Error","message":"_hit$_source4.components.map is not a function"}`

The error occurs here when the components field contains unexpected data.

Fleet expects this field to always be an array having this format:

"components": [
  {
    "id": "fleet-server-es-containerhost",
    "message": "Healthy: communicating with pid '187'",
    "status": "HEALTHY",
    "type": "fleet-server",
    "units": []
  }
]

However in some cases it was observed to be missing or to be a string and this triggered the error:

"components": "W3siaWQiOiJ3aW5kb3dzLlIjoiU3RhcnRplkICc0NTCI6ImUyJyJ9XX1d"

One thing to investigate is why sometimes this field has a different content than expected, did it change something in Fleet Server or it's due to an error?

Steps to reproduce:
I'm not sure how to reproduce it the actual error, as it was observed in production.
However it can be forced locally by inserting some data with the invalid format in the fleet agents index.

Expected behavior:
Fleet should handle more gracefully this type of "invalid" documents instead of breaking the api response.

@criamico criamico added bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team labels Mar 6, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@criamico
Copy link
Contributor Author

criamico commented Mar 6, 2025

I created this ticket but then I noticed that this bug was recently fixed in Fleet UI by #207746, available from version 8.18.0 and above.

@criamico criamico closed this as completed Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

No branches or pull requests

2 participants