OpenSearch-Dashboards icon indicating copy to clipboard operation
OpenSearch-Dashboards copied to clipboard

[BUG] Startup fails with theme overrides

Open BionIT opened this issue 1 year ago • 10 comments

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):

  • OS: [e.g. iOS]
  • Browser and version [e.g. 22]

Additional context

Add any other context about the problem here.

BionIT avatar May 02 '24 19:05 BionIT

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 avatar May 02 '24 20:05 BionIT

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 avatar May 02 '24 20:05 BionIT

Found issue still happening, thus re-opened

BionIT avatar May 03 '24 00:05 BionIT

@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

joshuarrrr avatar May 03 '24 00:05 joshuarrrr

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.

BionIT avatar May 03 '24 00:05 BionIT

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

joshuarrrr avatar May 03 '24 01:05 joshuarrrr

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

ananzh avatar May 03 '24 03:05 ananzh

To repro:

  • add the commit, see empty page and error in future playground
  • remove the commit, OSD bootstraps correctly in playground

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

BionIT avatar May 03 '24 03:05 BionIT

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 avatar May 03 '24 10:05 kavilla

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

kavilla avatar May 07 '24 23:05 kavilla

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

BionIT avatar Jun 04 '24 01:06 BionIT