Using vscode:extension/MS-SarifVSCode.sarif-viewer in local docker fails
January 15, 2020 at 1:31pmUsing vscode:extension/MS-SarifVSCode.sarif-viewer in local docker fails
January 15, 2020 at 1:31pmHi I want to test vscode:extension/MS-SarifVSCode.sarif-viewer in a local docker instance of Theia. It's working on gitpod and VSCode but for Theia it says "server adress could not be found" for a webview. Might this be related to me not accessing theia over https?
January 15, 2020 at 1:32pm
January 16, 2020 at 1:36am
Do you have any errors in browser and backend process logs?
and yes webviews are working only in secure context, that is https or localhost
January 16, 2020 at 10:00am
Thanks for your reply!
Hm, then the issue might not be related to me not using https since I'm working on localhost.
Actually I'm wrong I wasn't using Theia on localhost. I now tried to do that but I cannot access 127.0.0.1:3000 (Emtpy response) when I tell Theia's hostname to 127.0.0.1.
I'm attaching the output and my docker setup...
The webview basically says "the sever ip of localhost could not be found"
And when I try to host Theia on localhost, I don't get a response...
I would very much appreciate your input here.
Also, I'm not much into web technology in general. Could you elaborate on the implications when hosting Theia on a server? How do I need to configure the extensions to work in that context? Do I need to set the THEIA_WEBVIEW_EXTERNAL_ENDPOINT variable in that case as well or would it be enough to put Theia behind a revers proxy with enforced https to get it working together with the extension?
For the sake of completeness, here is my package.json:
{
"private": true,
"theia": {
"frontend": {
"config": {
"applicationName": "Test",
"preferences": {
"files.enableTrash": false
}
}
}
},
"dependencies": {
"/editor-preview": "next",
"/file-search": "next",
"/getting-started": "next",
"/git": "next",
"/java": "next",
"/json": "next",
"/markers": "next",
"/messages": "next",
"/navigator": "next",
"/outline-view": "next",
"/preferences": "next",
"/search-in-workspace": "next",
"/terminal": "next",
"/textmate-grammars": "next",
"/tslint": "next",
"/typescript": "next",
"typescript": "next",
"/plugin-ext": "next",
"/plugin": "next",
"/plugin-ext-vscode": "next"
},
"resolutions": {
"vscode-languageserver-protocol": "3.15.0-next.9",
"vscode-languageserver-types": "3.15.0-next.9",
"/vscode-json-languageserver//vscode-languageserver": "6.0.0-next.1"
},
"devDependencies": {
"/cli": "next"
}
}
{{localhost}}
won't do anything {{..}}
is a placeholderIt depends on what your proxy does, if it somehow rewrites the host then you will need to modify
THEIA_WEBVIEW_EXTERNAL_ENDPOINT
to reflect it, if not then you don't need to change itAlso replacing with
THEIA_WEBVIEW_EXTERNAL_ENDPOINT=localhost
is not necessary, if you can access the page from localhost. Theia will be able to figure it from the default pattern, i.e. the default pattern is {{uuid}}.webview.{{hostname}}
, since Theia is served from localhost, at runtime it will be computed to someid.webview.localhost
.replacing
THEIA_WEBVIEW_EXTERNAL_ENDPOINT
with localhost
can also cause security issuesJanuary 17, 2020 at 2:00am
request URL looks bogus, hostname is
%7b%7Blocalhost%7B%7B
, please remove {{ and }}, they are for placeholdersrequest URL looks bogus, hostname is
%7b%7Blocalhost%7B%7B
, please remove {{ and }}, they are for placeholdersJanuary 17, 2020 at 9:03am
I see! So I changed the endpoint to THEIA_WEBVIEW_EXTERNAL_ENDPOINT=localhost and I get "Not Found
The requested URL was not found on this server." in the extension view. I started Theia with "--hostname=0.0.0.0". I guess the url cannot be found since now the webview and Theia are running on different hosts? (localhost vs 0.0.0.0)