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

[Obs AI Assistant] Handle Axios errors correctly #186790

Merged

Conversation

dgieselaar
Copy link
Member

@dgieselaar dgieselaar commented Jun 24, 2024

the kibana function throws an axios error, and it resulted in an error because toJSON() doesn't actually return a string like I expected it to, it returns a structured object that can be converted into a string by calling JSON.stringify().

@dgieselaar dgieselaar added bug Fixes for quality problems that affect the customer experience v8.15.0 v8.14.2 labels Jun 24, 2024
@dgieselaar dgieselaar self-assigned this Jun 24, 2024
@dgieselaar dgieselaar requested a review from a team as a code owner June 24, 2024 08:59
@obltmachine
Copy link

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@dgieselaar dgieselaar added the release_note:skip Skip the PR/issue when compiling release notes label Jun 24, 2024
@kibana-ci
Copy link
Collaborator

kibana-ci commented Jun 24, 2024

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @dgieselaar

}

delete sanitizedError.stack;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I have an aversion against delete and prefer explicitly picking the properties we expect

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be omit in that case (no way for us to account for all the possible properties of this object). In this case I prefer deleteing properties of an object that is created a few lines up over having to re-assign stuff because of omit/pick.

@dgieselaar dgieselaar merged commit ca41e66 into elastic:main Jun 25, 2024
38 checks passed
@dgieselaar dgieselaar deleted the obs-ai-assistant-handle-axios-errors branch June 25, 2024 06:38
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 25, 2024
the `kibana` function throws an axios error, and it resulted in an error
because `toJSON()` doesn't actually return a string like I expected it
to, it returns a structured object that can be converted into a string
by calling JSON.stringify().

(cherry picked from commit ca41e66)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.14

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jun 25, 2024
…86865)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[Obs AI Assistant] Handle Axios errors correctly
(#186790)](#186790)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Dario
Gieselaar","email":"dario.gieselaar@elastic.co"},"sourceCommit":{"committedDate":"2024-06-25T06:38:22Z","message":"[Obs
AI Assistant] Handle Axios errors correctly (#186790)\n\nthe `kibana`
function throws an axios error, and it resulted in an error\r\nbecause
`toJSON()` doesn't actually return a string like I expected it\r\nto, it
returns a structured object that can be converted into a string\r\nby
calling
JSON.stringify().","sha":"ca41e6685ea245ea8d7fb3f39b31fa18f5134821","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:Obs
AI
Assistant","ci:project-deploy-observability","v8.15.0","v8.14.2"],"title":"[Obs
AI Assistant] Handle Axios errors
correctly","number":186790,"url":"#186790
AI Assistant] Handle Axios errors correctly (#186790)\n\nthe `kibana`
function throws an axios error, and it resulted in an error\r\nbecause
`toJSON()` doesn't actually return a string like I expected it\r\nto, it
returns a structured object that can be converted into a string\r\nby
calling
JSON.stringify().","sha":"ca41e6685ea245ea8d7fb3f39b31fa18f5134821"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"#186790
AI Assistant] Handle Axios errors correctly (#186790)\n\nthe `kibana`
function throws an axios error, and it resulted in an error\r\nbecause
`toJSON()` doesn't actually return a string like I expected it\r\nto, it
returns a structured object that can be converted into a string\r\nby
calling
JSON.stringify().","sha":"ca41e6685ea245ea8d7fb3f39b31fa18f5134821"}},{"branch":"8.14","label":"v8.14.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience ci:project-deploy-observability Create an Observability project release_note:skip Skip the PR/issue when compiling release notes Team:Obs AI Assistant v8.14.2 v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants