elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.63k stars 8.22k forks source link

Kibana should display error message with information instead of internal server error when user tries to import buggy saved objects #102554

Closed bhavyarm closed 4 months ago

bhavyarm commented 3 years ago

Kibana version: 7.13.2

Elasticsearch version: 7.13.2

Server OS version: darwin_x86_64

Browser version: chrome latest

Browser OS version: OS X

Original install method (e.g. download page, yum, from source, etc.): from staging

Describe the bug: If user tries to import the attached saved object .ndJSON , Kibana displays internal server error instead of displaying what actually is the problem with this file.

Please note if user upgrades with these saved objects - upgrade fails (bug - https://github.com/elastic/kibana/pull/101470)

Steps to reproduce:

  1. Get your ES and Kibana up
  2. Try to import the attached saved object .ndJSON file
  3. Import fails with internal server error
  4. Kibana stays operational unlike in upgrades

Screenshots (if relevant):

Screen Shot 2021-06-10 at 5 56 05 PM (1)

export_7.12.1 .ndjson.zip

Provide logs and/or server output (if relevant):

Kibana logs:

g   [17:46:39.495] [info][plugins][reporting] Extracting [/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/.chromium/chromium-d163fd7-darwin_x64.zip] to [/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/x-pack/plugins/reporting/chromium]
  log   [17:46:40.683] [info][plugins][reporting] Browser executable: /Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/x-pack/plugins/reporting/chromium/headless_shell-darwin_x64/headless_shell
  log   [17:55:45.538] [error][savedobjects-service] TypeError: embeddables.getEnhancement(...).migrations[version] is not a function
    at /Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/plugins/embeddable/common/lib/migrate.js:30:91
    at Array.forEach (<anonymous>)
    at Object.migrate (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/plugins/embeddable/common/lib/migrate.js:28:31)
    at /Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/plugins/dashboard/server/saved_objects/dashboard_migrations.js:187:45
    at Array.forEach (<anonymous>)
    at /Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/plugins/dashboard/server/saved_objects/dashboard_migrations.js:181:10
    at tryTransformDoc (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/migrations/core/document_migrator.js:547:22)
    at migrateProp (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/migrations/core/document_migrator.js:631:22)
    at applyMigrations (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/migrations/core/document_migrator.js:350:20)
    at DocumentMigrator.transformAndValidate [as transformDoc] (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/migrations/core/document_migrator.js:290:22)
    at DocumentMigrator.migrate (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/migrations/core/document_migrator.js:81:16)
    at KibanaMigrator.migrateDocument (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/migrations/kibana/kibana_migrator.js:222:34)
    at /Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/service/lib/repository.js:370:74
    at Array.map (<anonymous>)
    at SavedObjectsRepository.bulkCreate (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/service/lib/repository.js:311:49)
    at SavedObjectsClient.bulkCreate (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/service/saved_objects_client.js:46:35)
  log   [17:55:45.550] [error][http] Error: Failed to transform document 35ce3b30-ca29-11eb-bf5e-3de94e83d4f0. Transform: dashboard:7.13.1
Doc: {"id":"35ce3b30-ca29-11eb-bf5e-3de94e83d4f0","type":"dashboard","attributes":{"description":"","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"filter\":[]}"},"optionsJSON":"{\"hidePanelTitles\":false,\"useMargins\":true}","panelsJSON":"[{\"version\":\"7.12.1\",\"type\":\"lens\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"60aaea59-d871-4e90-9ff3-78946d6bef90\"},\"panelIndex\":\"60aaea59-d871-4e90-9ff3-78946d6bef90\",\"embeddableConfig\":{\"attributes\":{\"title\":\"\",\"type\":\"lens\",\"visualizationType\":\"lnsPie\",\"state\":{\"datasourceStates\":{\"indexpattern\":{\"layers\":{\"2174c5fe-75d2-43ae-9c79-1a7cc7bbbaea\":{\"columns\":{\"65625f0d-e7f1-4370-b939-7db27af74de7\":{\"label\":\"Top values of geo.srcdest\",\"dataType\":\"string\",\"operationType\":\"terms\",\"scale\":\"ordinal\",\"sourceField\":\"geo.srcdest\",\"isBucketed\":true,\"params\":{\"size\":18,\"orderBy\":{\"type\":\"column\",\"columnId\":\"553a353f-dac5-4a52-a25d-52c6e1462597\"},\"orderDirection\":\"desc\",\"otherBucket\":true,\"missingBucket\":false}},\"553a353f-dac5-4a52-a25d-52c6e1462597\":{\"label\":\"Count of records\",\"dataType\":\"number\",\"operationType\":\"count\",\"isBucketed\":false,\"scale\":\"ratio\",\"sourceField\":\"Records\"}},\"columnOrder\":[\"65625f0d-e7f1-4370-b939-7db27af74de7\",\"553a353f-dac5-4a52-a25d-52c6e1462597\"],\"incompleteColumns\":{}}}}},\"visualization\":{\"shape\":\"donut\",\"layers\":[{\"layerId\":\"2174c5fe-75d2-43ae-9c79-1a7cc7bbbaea\",\"groups\":[\"65625f0d-e7f1-4370-b939-7db27af74de7\",\"65625f0d-e7f1-4370-b939-7db27af74de7\",\"65625f0d-e7f1-4370-b939-7db27af74de7\"],\"metric\":\"553a353f-dac5-4a52-a25d-52c6e1462597\",\"numberDisplay\":\"percent\",\"categoryDisplay\":\"default\",\"legendDisplay\":\"default\",\"nestedLegend\":false}]},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[]},\"references\":[{\"type\":\"index-pattern\",\"id\":\"43fcac20-ca27-11eb-bf5e-3de94e83d4f0\",\"name\":\"indexpattern-datasource-current-indexpattern\"},{\"type\":\"index-pattern\",\"id\":\"43fcac20-ca27-11eb-bf5e-3de94e83d4f0\",\"name\":\"indexpattern-datasource-layer-2174c5fe-75d2-43ae-9c79-1a7cc7bbbaea\"}]},\"enhancements\":{\"dynamicActions\":{\"events\":[{\"eventId\":\"9ed45b8b-534b-4fac-9fee-436896b90039\",\"triggers\":[\"FILTER_TRIGGER\"],\"action\":{\"name\":\"circular drilldown\",\"config\":{\"useCurrentFilters\":true,\"useCurrentDateRange\":true},\"factoryId\":\"DASHBOARD_TO_DASHBOARD_DRILLDOWN\"}}]}}}}]","timeRestore":false,"title":"lens_panel_drilldown","version":1},"migrationVersion":{"dashboard":"7.11.0"},"updated_at":"2021-06-10T21:55:45.536Z","references":[{"id":"43fcac20-ca27-11eb-bf5e-3de94e83d4f0","name":"indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"43fcac20-ca27-11eb-bf5e-3de94e83d4f0","name":"indexpattern-datasource-layer-2174c5fe-75d2-43ae-9c79-1a7cc7bbbaea","type":"index-pattern"},{"id":"08dec860-ca29-11eb-bf5e-3de94e83d4f0","name":"drilldown:DASHBOARD_TO_DASHBOARD_DRILLDOWN:9ed45b8b-534b-4fac-9fee-436896b90039:dashboardId","type":"dashboard"},{"id":"07f48f70-ca29-11eb-bf5e-3de94e83d4f0","name":"tag-07f48f70-ca29-11eb-bf5e-3de94e83d4f0","type":"tag"}]}
    at tryTransformDoc (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/migrations/core/document_migrator.js:562:13)
    at migrateProp (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/migrations/core/document_migrator.js:631:22)
    at applyMigrations (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/migrations/core/document_migrator.js:350:20)
    at DocumentMigrator.transformAndValidate [as transformDoc] (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/migrations/core/document_migrator.js:290:22)
    at DocumentMigrator.migrate (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/migrations/core/document_migrator.js:81:16)
    at KibanaMigrator.migrateDocument (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/migrations/kibana/kibana_migrator.js:222:34)
    at /Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/service/lib/repository.js:370:74
    at Array.map (<anonymous>)
    at SavedObjectsRepository.bulkCreate (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/service/lib/repository.js:311:49)
    at SavedObjectsClient.bulkCreate (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/service/saved_objects_client.js:46:35)
    at EncryptedSavedObjectsClientWrapper.bulkCreate (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/x-pack/plugins/encrypted_saved_objects/server/saved_objects/encrypted_saved_objects_client_wrapper.js:69:93)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at SpacesSavedObjectsClient.bulkCreate (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/x-pack/plugins/spaces/server/saved_objects/spaces_saved_objects_client.js:123:12)
    at createSavedObjects (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/import/lib/create_saved_objects.js:104:32)
    at importSavedObjectsFromStream (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/saved_objects/import/import_saved_objects.js:89:36)
 error  [17:55:45.509]  Error: Internal Server Error
    at HapiResponseAdapter.toInternalError (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/http/router/response_adapter.js:61:19)
    at Router.handle (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/http/router/router.js:177:34)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at handler (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/src/core/server/http/router/router.js:124:50)
    at exports.Manager.execute (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/node_modules/@hapi/hapi/lib/toolkit.js:60:28)
    at Object.internals.handler (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/node_modules/@hapi/hapi/lib/handler.js:46:20)
    at exports.execute (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/node_modules/@hapi/hapi/lib/handler.js:31:20)
    at Request._lifecycle (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/node_modules/@hapi/hapi/lib/request.js:370:32)
    at Request._execute (/Users/bhavyarajumandya/Desktop/release_7.12.1/kibana-7.13.1-darwin-x86_64/node_modules/@hapi/hapi/lib/request.js:279:9)
elasticmachine commented 3 years ago

Pinging @elastic/kibana-core (Team:Core)

rayafratkina commented 4 months ago

We currently have no way to validate SOs, so not planning to fix in the near term.