-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Fix saving index pattern when there is a conflict #21947
Conversation
@@ -232,6 +232,16 @@ export class SavedObjectsClient { | |||
return Promise.reject(new Error('body not permitted for GET requests')); | |||
} | |||
|
|||
return kfetch({ method, pathname: path, query, body: JSON.stringify(body) }); | |||
return kfetch({ method, pathname: path, query, body: JSON.stringify(body) }) | |||
.catch(resp => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that you are not getting the REST resp
from kfetch. kfetch is going to reject the promise with a FetchError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FetchError
still has res
and body
properties:
https://github.com/elastic/kibana/blob/master/src/ui/public/kfetch/kfetch.ts#L29
I'll rename these variables so they reflect an instance of FetchError
.
This is going to break places that have been updated to handle a FetchError. I would recommend just updating the consumers to directly handle FetchError. |
@nreese Thanks for those references! I'm concerned about the places that haven't been updated to know about FetchError and are still attempting to read top level I'll update this PR to modify the index pattern client instead in the meantime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
code review
💔 Build Failed
|
Retest |
💔 Build FailedSame failure as above. Passes locally 😞Merging master to see if that helps. |
💔 Build FailedWeird ES-related failures. Aborted. |
Retest |
💔 Build Failed |
Retest |
💚 Build Succeeded |
@jen-huang What will happen now in this same case? What will the user see? In the issue this PR fixes, it could really be any Kibana user that does something that causes a change to the index pattern while you're trying to format a field or add a scripted field which causes the version conflict. |
Fixes #21932
Changes in #20384 changed error handling to return kfetch's
FetchError
object. Saving index pattern is dependent onstatusCode
, which is not a top level property ofFetchError
. PR updates to look forres.status
instead.