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

Saved Objects config type export broken on master #59349

Closed
majagrubic opened this issue Mar 4, 2020 · 9 comments · Fixed by #59291
Closed

Saved Objects config type export broken on master #59349

majagrubic opened this issue Mar 4, 2020 · 9 comments · Fixed by #59291
Assignees
Labels
blocker bug Fixes for quality problems that affect the customer experience Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.7.0

Comments

@majagrubic
Copy link
Contributor

majagrubic commented Mar 4, 2020

Kibana version: Master

Elasticsearch version: Snapshot

Server OS version: Mac OS 10.14.5

Browser version: Chrome 80.0

Browser OS version: Mac OS 10.14.5

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

Describe the bug:
Saved Objects Export fails with status 400.

{"statusCode":400,"error":"Bad Request","message":"[request body.type]: types that failed validation:\n- [request body.type.0]: expected value of type [string] but got [Array]\n- [request body.type.1.6]: config is not exportable"}

Steps to reproduce:
0. Add Kibana Sample Data

  1. Go to Kibana Management Console > Saved Objects
  2. In the header of Saved Objects table, select "Export 54 Objects" (there should be 54 from the sample data)
  3. Click Export All
  4. Error message is displayed

Expected behavior:
.ndjson file is generated and ready for download.

Screenshots (if relevant):
Screenshot 2020-03-04 at 18 01 56

Errors in browser console (if relevant):
Response:

{"statusCode":400,"error":"Bad Request","message":"[request body.type]: types that failed validation:\n- [request body.type.0]: expected value of type [string] but got [Array]\n- [request body.type.1.6]: config is not exportable"}

Provide logs and/or server output (if relevant):
I don't see anything weird in the server log.

Any additional context:
Selecting individual objects and exporting them succeeds.
Screenshot 2020-03-04 at 18 00 43

This works fine on 7.6.0 so must have been recently introduced.

@majagrubic majagrubic added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Mar 4, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@majagrubic majagrubic added bug Fixes for quality problems that affect the customer experience Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages labels Mar 4, 2020
@joshdover
Copy link
Contributor

@pgayvallet would you be able to look at this one since you’re working in this area? My guess is that we broke this in one of the recent changes to these routes or the validation parsing of arrays.

@joshdover
Copy link
Contributor

The fact that we have no tests to catch this is a little alarming as well 😬

@pgayvallet
Copy link
Contributor

The fact that we have no tests to catch this is a little alarming as well

The fact that we actually do might scare you even more then: test/api_integration/apis/saved_objects/export.js

@joshdover
Copy link
Contributor

I was able to reproduce this issue as well

I'm guessing that the input data in the API tests don't match what the UI is actually sending right now. We probably need true e2e tests that click through the UI.

@pgayvallet
Copy link
Contributor

[request body.type.0]: expected value of type [string] but got [Array]

This part of the error message makes me think the export is sending a nested array of types, which definitly should not be permitted (but that probably was accepted before the migration...)

\n- [request body.type.1.6]: config is not exportable"}

@majagrubic is the config type registration migrated to NP ? If so, that broke the import/export attribute of the type until #59291 is merged, so that would explain that one.

@majagrubic
Copy link
Contributor Author

is the config type registration migrated to NP?

I'm sorry, not sure what this refers to. I've run this on about a day-old master and a brand new ES snapshot, whatever was in master by then is what you're seeing here.

@pgayvallet pgayvallet self-assigned this Mar 4, 2020
@pgayvallet
Copy link
Contributor

TIL the config type is handled differently than the others. It's not properly registered from any plugin, and instead is present in the default mapping

function defaultMapping(): IndexMapping {
return {
dynamic: 'strict',
properties: {
config: {
dynamic: 'true',
properties: {
buildNum: {
type: 'keyword',
},
},
},

The legacy SO service was using the root properties of the mappings as the 'types' references, therefor accessing it

const allTypes = Object.keys(getRootPropertiesObjects(mappings));

In NP, we properly check the type registry instead, where the config type is not present.

We should handle config type as any other SO type, and register it, probably from core itself.

This depends on #59291, as we need to be able to register the management section for the type.

@pgayvallet pgayvallet changed the title Saved Objects Export broken on master Saved Objects config type export broken on master Mar 4, 2020
@joshdover
Copy link
Contributor

Marking as a blocker for 7.7 to make sure this doesn't get missed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker bug Fixes for quality problems that affect the customer experience Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.7.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants