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

Correctly load frontend plugins when deployed under a path #13813

Closed
sgraband opened this issue Jun 14, 2024 · 1 comment · Fixed by #13854
Closed

Correctly load frontend plugins when deployed under a path #13813

sgraband opened this issue Jun 14, 2024 · 1 comment · Fixed by #13854

Comments

@sgraband
Copy link
Contributor

Bug Description:

Currently in worker-main importScripts is used to load the plugin-vscode-init-fe.ts. However, this does not work for instances, where Theia is not hosted at the base-url (or origin), like the try.theia-cloud.io deployment, where each instance of Theia is hosted under ws.theia-cloud.io/<pod-id>.

After a quick investigation the problem seems to be that importScripts is called with /context/<file-name>, which is a absolute path. Hence it resolves to only base-url/context/<file-name>, whereas we would need base-url/<pod-id>/context/<file-name>. This could be fixed by simply calling importScripts with ./context/<file-name>. I already tested this and it seems to work.

Does anyone have any concerns about that change? It should not change the behavior for other use cases, but fix the issue for that specifc scenario.

I can gladly contribute this.

Steps to Reproduce:

  1. Use a hosted Theia instance that is running under a path (e.g. https://try.theia-cloud.io/ - path meaning, that the pods are running under ws.theia-cloud.io/<pod-id> and not just ws.theia-cloud.io)
  2. Install a frontend-only vscode extension
  3. Observe that the console throws and error that the plugin-vscode-init-fe.js fails to load.

Additional Information

  • Operating System:
  • Theia Version:
@msujew
Copy link
Member

msujew commented Jun 14, 2024

@sgraband We had a similar issue related to loading resources from notebook output webviews. See #12976. A fix would likely be similar.

sgraband added a commit to eclipsesource/theia that referenced this issue Jun 27, 2024
Before we tried to load absolute paths e.g. `/context/`.
This is a problem, when working in deployed use cases, where Theia might be hosted under a path (e.g. try.theia-cloud.io).
Because then the loaded path will be from the root of the page and not, like wanted, from the current path.
Simply changing it to relative paths (e.g. `./context/`) solves this issue.

Fixes eclipse-theia#13813
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants