Dashboard migrations fail silently during upgrade causing unexpected behaviour thats difficult to detect #139684
Labels
Feature:Dashboard
Dashboard related features
impact:medium
Addressing this issue will have a medium level of impact on the quality/strength of our product.
loe:large
Large Level of Effort
Team:Presentation
Presentation Team for Dashboard, Input Controls, and Canvas
Many (most?) of the dashboard migrations follow a pattern where we wrap the migration function in a
try
block and if an exception was caught or the dashboard has invalid data we just silently ignore it and return the document unmigrated.E.g.
https://github.com/elastic/kibana/blob/main/src/plugins/dashboard/server/saved_objects/migrations_730.ts#L17-L21
https://github.com/elastic/kibana/blob/main/src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts#L47-L52
https://github.com/elastic/kibana/blob/main/src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts#L91-L96
This can cause several problems:
migrationVersion
but in fact aren't so there's no easy way to identify such documentsFor these reasons our documentation states that migration functions should be written defensively but fail on invalid data:
https://github.com/elastic/kibana/blob/main/dev_docs/tutorials/saved_objects.mdx#L251-L253
Now that we're in this situation we cannot just go and rewrite all existing migration functions. So I would suggest the following course of action:
create
orbulkCreate
. #118969 to ensure that all new dashboards that are created or imported have the schema we expect them to have. This at least prevents further problems from being created.The text was updated successfully, but these errors were encountered: