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

Remove SavedObjects missing index error handling and associated error UI. #55667

Closed
rudolf opened this issue Jan 23, 2020 · 2 comments
Closed
Labels
chore Feature:Legacy Removal Issues related to removing legacy Kibana Feature:New Platform Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@rudolf
Copy link
Contributor

rudolf commented Jan 23, 2020

From what I can tell, before we had Saved Object migrations, it was possible for the SavedObjectsClient/repository to get a NotFound error when creating an Saved Object because the .kibana index doesn't yet exist and ES's auto create index setting was disabled. Since the migration framework handles creating the index, this would no longer be a common occurrence and would only happen in exceptional circumstances like if someone manually deleted their indexes. Simply throwing the raw NotFound error from ES is probably sufficient.

if (SavedObjectsErrorHelpers.isNotFoundError(error)) {
// See "503s from missing index" above
throw SavedObjectsErrorHelpers.createEsAutoCreateIndexError();
}

// TODO: Migrate to an error modal powered by the NP?
import {
isAutoCreateIndexError,
showAutoCreateIndexErrorPage,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../legacy/ui/public/error_auto_create_index/error_auto_create_index';

* ### 503s from missing index
*
* Unlike all other methods, create requests are supposed to succeed even when
* the Kibana index does not exist because it will be automatically created by
* elasticsearch. When that is not the case it is because Elasticsearch's
* `action.auto_create_index` setting prevents it from being created automatically
* so we throw a special 503 with the intention of informing the user that their
* Elasticsearch settings need to be updated.

public static createEsAutoCreateIndexError() {
const error = Boom.serverUnavailable('Automatic index creation failed');
error.output.payload.attributes = error.output.payload.attributes || {};
error.output.payload.attributes.code = 'ES_AUTO_CREATE_INDEX_ERROR';
return decorate(error, CODE_ES_AUTO_CREATE_INDEX_ERROR, 503);
}
public static isEsAutoCreateIndexError(error: Error | DecoratedError) {
return isSavedObjectsClientError(error) && error[code] === CODE_ES_AUTO_CREATE_INDEX_ERROR;
}

https://github.com/elastic/kibana/blob/ea9721ad13d1496ebb96dfc6647699c21967fb91/src/legacy/ui/public/error_auto_create_index/error_auto_create_index.ts

@rudolf rudolf added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:New Platform Feature:Saved Objects labels Jan 23, 2020
@elasticmachine
Copy link
Contributor

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

@rudolf rudolf added the chore label Jan 23, 2020
@joshdover joshdover added the Feature:Legacy Removal Issues related to removing legacy Kibana label Apr 26, 2020
@joshdover
Copy link
Contributor

Duplicate of #63894

@joshdover joshdover marked this as a duplicate of #63894 Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Feature:Legacy Removal Issues related to removing legacy Kibana Feature:New Platform Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

3 participants