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

[Reporting] Handle error scenarios for deleted user and deleted saved object #191548

Closed
tsullivan opened this issue Aug 27, 2024 · 6 comments · Fixed by #197238
Closed

[Reporting] Handle error scenarios for deleted user and deleted saved object #191548

tsullivan opened this issue Aug 27, 2024 · 6 comments · Fixed by #197238
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Reporting:Framework Reporting issues pertaining to the overall framework good first issue low hanging fruit papercut Small "burr" in the product that we should fix. Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience)

Comments

@tsullivan
Copy link
Member

tsullivan commented Aug 27, 2024

This issue is based on an observation found via #191676

In the Reporting plugin, we have error codes that are assigned during report job runs in case the job fails. These codes are used to create meaningful error messages to users when the view the error details in the Reporting UI (Stack Management > Alerts & Insights > Reporting).

Error codes for Reporting are mapped in

export function mapToReportingError(error: ExecutionError | unknown): ReportingError {

Update the set of known errors and add codes for the following:

  • Data View saved object is deleted: During CSV export, when the report job runs it tries to load the data view saved object. If that data view saved object is not found, we need to provide a specific error of this scenario.
  • User authentication fails: During CSV export, if the cached user authentication details can't be used to read data from Elasticsearch, the report job will fail. We need to provide a specific error of this scenario.

Other:

  • Report job document is missing: Before any type of report job runs, Task Manager fires a task to the Reporting plugin, which reacts by attempting to load the report job document from the Reporting plugin's data stream. If this fails, nothing further can proceed, and in this case we can't write a specific error code anywhere because the report job document doesn't exist. We can reduce the possibility of this occurring by updating the Delete Report API to unschedule the task from task manager when a report document is deleted. This work is tracked by [Reporting] Delete Report: remove the scheduled task from Task Manager when report is deleted. #191551
@tsullivan tsullivan added the bug Fixes for quality problems that affect the customer experience label Aug 27, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Aug 27, 2024
@tsullivan tsullivan added Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) Feature:Reporting:Framework Reporting issues pertaining to the overall framework labels Aug 27, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Aug 27, 2024
@tsullivan tsullivan self-assigned this Sep 9, 2024
@petrklapka petrklapka added the good first issue low hanging fruit label Sep 23, 2024
@tsullivan tsullivan removed their assignment Sep 26, 2024
@dogakantarci
Copy link

Hi @tsullivan,

I’m interested in working on this issue. I have experience with error handling in Node.js and would love to contribute. Could you please confirm if this issue is still available for a good first issue?

Thanks!

@petrklapka petrklapka added the papercut Small "burr" in the product that we should fix. label Oct 17, 2024
@kowalczyk-krzysztof kowalczyk-krzysztof self-assigned this Oct 21, 2024
@kowalczyk-krzysztof
Copy link
Member

@tsullivan

Data View saved object is deleted

In the code, is the place where it happens here? If so, should this regular Error be replaced with a new error, for example DataViewSavedObjectNotFound?

User authentication fails

Isn't it handled already here?

@tsullivan
Copy link
Member Author

Data View saved object is deleted
In the code, is the place where it happens here? If so, should this regular Error be replaced with a new error, for example DataViewSavedObjectNotFound?

@kowalczyk-krzysztof It looks like the error we are interested in will be thrown in that file but a little higher up, in searchSourceStart.create:

this.dependencies.searchSourceStart.create(this.job.searchSource),

The way I tested this was:

  1. Create a POST URL of a saved search.
  2. Then wrap the URL in a shell script such as:
    #!/bin/sh
    
    curl -u elastic:changeme -XPOST \
     -H "kbn-xsrf: reporting" \
     "http://localhost:5601/wxh/api/reporting/generate/csv_searchsource?jobParams=%28browserTimezone%3AAmerica%2FPhoenix%2Ccolumns%3A%21%28%29%2CobjectType%3Asearch%2CsearchSource%3A%28fields%3A%21%28%28field%3A%27%2A%27%2Cinclude_unmapped%3A%21t%29%29%2Cfilter%3A%21%28%28meta%3A%28field%3Aorder_date%2Cindex%3Aff959d40-b880-11e8-a6d9-e546fe2bba5f%2Cparams%3A%28%29%29%2Cquery%3A%28range%3A%28order_date%3A%28format%3Astrict_date_optional_time%2Cgte%3Anow-30d%2Fd%2Clte%3Anow%29%29%29%29%29%2Cindex%3Aff959d40-b880-11e8-a6d9-e546fe2bba5f%2Cquery%3A%28language%3Akuery%2Cquery%3A%27%27%29%2Csort%3A%21%28%28order_date%3A%28format%3Astrict_date_optional_time%2Corder%3Adesc%29%29%29%29%2Ctitle%3A%27Untitled%20discover%20search%27%2Cversion%3A%279.0.0%27%29"
    
    (Replace the URL with the one that was copied from the Share modal)
  3. Then delete all of the index pattern saved objects.
  4. Then, run the shell script. An error will be thrown from the searchSourceStart.create line.

User authentication fails
Isn't it handled already here?

Correct, it looks like I misremembered that auth issues are handled correctly already. The AuthenticationExpiredError is doing exactly what we want for this issue. Thanks!

@tsullivan
Copy link
Member Author

We have another task to work on which is heavily related. I wrote about how the two things can come together: #196620 (comment)

@kowalczyk-krzysztof
Copy link
Member

@tsullivan Thanks for the explanation. It makes sense to work on #196620 at the same time, so I'll do that.

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 Feature:Reporting:Framework Reporting issues pertaining to the overall framework good first issue low hanging fruit papercut Small "burr" in the product that we should fix. Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants