opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.63k stars 848 forks source link

[BUG] Startup fails with theme overrides #6704

Closed BionIT closed 4 days ago

BionIT commented 3 months ago

Describe the bug

A clear and concise description of what the bug is. Screenshot 2024-05-02 at 12 15 07 PM Screenshot 2024-05-02 at 12 15 15 PM Screenshot 2024-05-02 at 12 15 25 PM

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

OpenSearch Version Please list the version of OpenSearch being used.

Dashboards Version Please list the version of OpenSearch Dashboards being used.

Plugins

Please list all plugins currently enabled.

Screenshots

If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

Additional context

Add any other context about the problem here.

BionIT commented 3 months ago

checkout a commit older than this PR would resolve thus narrow down to this PR https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5652

BionIT commented 3 months ago

Different from the screen recording in the PR https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6703

The dashboard in future playground won't display anything

BionIT commented 3 months ago

Found issue still happening, thus re-opened

joshuarrrr commented 3 months ago

@BionIT Can you provide some repro details? If I visit https://future.playground.opensearch.org, this is what I see

Screenshot 2024-05-02 at 5 40 48 PM
BionIT commented 3 months ago

Yep, @joshuarrrr this is after switching to an older commit than the PR which introduced the bug, otherwise, we see empty page. Please check future playground for the empty page and error now.

joshuarrrr commented 3 months ago

I just need more info to be able to debug it, so if there was a version that included https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6703 and https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5652, that would be really helpful, because it doesn't repro running locally. I can also provide some additional context:

The issue is likely not in /bootstrap.js (source: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/legacy/ui/ui_render/bootstrap/bootstrap.js.hbs ), despite that being the failure point. To start up correctly, that application requires /startup.js ( source: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/legacy/ui/ui_render/bootstrap/startup.js.hbs )to successfully load and execute first. You can see in the console that startup.js failed on an unexpected token on L15: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/legacy/ui/ui_render/bootstrap/startup.js.hbs#L15

That means that there's likely an issue with this block of code:

https://github.com/opensearch-project/OpenSearch-Dashboards/blob/b5121d37a66f067148056ca9a404634f3a682f94/src/legacy/ui/ui_render/ui_render_mixin.js#L174-L177

which wasn't edited, but moved in https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5652

ananzh commented 3 months ago

@BionIT same question here, is there a way to reproduce locally or could you help to add some repro steps?

BionIT commented 3 months ago

To repro:

I don't have bandwidth to look further, and I wonder if the change would behave different when it is in container?

kavilla commented 3 months ago

i think cache issue. that supercedes the cache buster for plugins.

2.13 navigate to playground/app/plugin HTML dom gets loaded with only reference to script bootstrap HTML dom downloads new bootstrap script due to cache busting mechanism bootstrap statically sets that window osdThemeTag

2.14 navigate to playground/app/plugin HTML dom gets loaded from cache since visiting again. but it only has the reference to bootstrap, and does not include startup.js HTML dom downloads new bootstrap script due to cache busting mechanism bootstrap expected startup.js to be downloaded and ran to set that global window value. get undefined exception

expected: HTML dom gets loaded with both startup and bootstrap.

tbh i'm not sure if this normal issue or something special about docker's caching optimization. we could consider just adding a default value to that osdThemeTag in bootstrap if window.osdThemeTag is undefined. @joshuarrrr @ananzh.

kavilla commented 3 months ago

reverted in 2.14 in 2.x as @joshuarrrr is addressing existing issue that got exposed by this work but not from this work.

BionIT commented 2 months ago

@joshuarrrr Do we still target this fix for 2.15 or 2.16?