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

TypeError in the browser's developer console #4346

Closed
Tracked by #4391
juliamagan opened this issue Jul 19, 2022 · 2 comments · Fixed by #4362
Closed
Tracked by #4391

TypeError in the browser's developer console #4346

juliamagan opened this issue Jul 19, 2022 · 2 comments · Fixed by #4362
Assignees
Labels
qa/report QA Team: Reporting possible bug type/bug Bug issue

Comments

@juliamagan
Copy link
Member

Wazuh Elastic Rev Security
4.3.6 7.x 4307 Basic, ODFE, Xpack
Browser
Firefox

Description
When accessing Home from another Opensearch module we get:

TypeError: NetworkError when attempting to fetch resource.
    Wrapper https://demo-436-info-wazuh-5d79494dfa1b98ee.elb.us-west-1.amazonaws.com/1/bundles/core/core.entry.js:6
    _createSuperInternal https://demo-436-info-wazuh-5d79494dfa1b98ee.elb.us-west-1.amazonaws.com/1/bundles/core/core.entry.js:6
    HttpFetchError https://demo-436-info-wazuh-5d79494dfa1b98ee.elb.us-west-1.amazonaws.com/1/bundles/core/core.entry.js:6
    _callee3$ https://demo-436-info-wazuh-5d79494dfa1b98ee.elb.us-west-1.amazonaws.com/1/bundles/core/core.entry.js:6
    tryCatch https://demo-436-info-wazuh-5d79494dfa1b98ee.elb.us-west-1.amazonaws.com/1/bundles/plugin/indexManagementDashboards/indexManagementDashboards.plugin.js:1
    invoke https://demo-436-info-wazuh-5d79494dfa1b98ee.elb.us-west-1.amazonaws.com/1/bundles/plugin/indexManagementDashboards/indexManagementDashboards.plugin.js:1

Preconditions

  1. Demo environment

Steps to reproduce

  1. Navigate to any module outside Wazuh
  2. Click on Home

Expected Result

  1. No errors in the browser's developer console

Actual Result

  1. TypeError

Screenshots

typeerror.mp4
@Desvelao
Copy link
Member

Desvelao commented Jul 19, 2022

Research

I could replate in Firefox, not in Google Chrome.
image (8)

In Firefox, seeing the Network browser tab, there is a request that could be throwing the problem:

  • GET /api/check-wazuh
    image

This could be related to the request that could have been canceled and for reason, Firefox shows an error in the console.

To see the request, you could need to enable the Preserve logs setting in the browser deb tools.

@juliamagan juliamagan moved this to Triage in Release 4.3.6 Jul 19, 2022
@AlexRuiz7 AlexRuiz7 moved this to Triage in Release 4.3.7 Jul 20, 2022
@davidjiglesias davidjiglesias moved this from Triage to Todo in Release 4.3.7 Jul 22, 2022
@chantal-kelm chantal-kelm self-assigned this Jul 22, 2022
@chantal-kelm chantal-kelm moved this from Todo to In Progress in Release 4.3.7 Jul 22, 2022
@chantal-kelm chantal-kelm moved this from In Progress to In review in Release 4.3.7 Jul 28, 2022
@chantal-kelm chantal-kelm linked a pull request Jul 28, 2022 that will close this issue
@chantal-kelm
Copy link
Member

chantal-kelm commented Jul 28, 2022

Research

In public/plugin.ts a Get request is done with a Kibana resource core.http.get(/api/check-wazuh).

That resource fails in Chrome and Firefox browsers.

The Kibana core get resource is set up to catch the error with an HttpFetchError class that is a child of the Node Error class. Which is compatible only with browsers with V8 engine.
For this reason in Chrome it shows the error in the console as a debug and in Firefox it shows it in the console as an unrecognized error.

In the http_fetch_errors.ts and globals.d.ts files, kibana mentions V8 compatibility and that it will only work in browsers that use it. Attached screenshots
https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces

Screenshot from 2022-08-03 07-10-11
Screenshot from 2022-08-03 07-11-00

Proposed solution

Change the Get request that was made with a Kibana core.http.get(/api/check-wazuh) resource to the WzRequest.genericReq resource and add a test capture to public/plugin.ts wrapping the request so that the error is detected when the navigator does not work with the V8 engine.

Test

  • Click on the hamburger menu
  • Click on dashboard
  • Click on home
  • Click on Wazuh
  • Check that the console does not show: TypeError: NetworkError when attempting to fetch resource
videofirefox.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qa/report QA Team: Reporting possible bug type/bug Bug issue
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants