Using vscode:extension/MS-SarifVSCode.sarif-viewer in local docker fails

Hi 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?

[original thread by Manuel Benz]

[Manuel Benz]

Installation works, but opening the SARIF view does not work :frowning:

Could you share a screenshot please?

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

[Manuel Benz]

Thanks for your reply!
Hm, then the issue might not be related to me not using https since I’m working on localhost.

[Manuel Benz]

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…

[Manuel Benz]

[Manuel Benz]

[Manuel Benz]

[Manuel Benz]

The webview basically says “the sever ip of localhost could not be found”

[Manuel Benz]

And when I try to host Theia on localhost, I don’t get a response…

[Manuel Benz]

[Manuel Benz]

I would very much appreciate your input here.

[Manuel Benz]

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?

[Manuel Benz]

For the sake of completeness, here is my package.json:

{
“private”: true,
“theia”: {
“frontend”: {
“config”: {
“applicationName”: “Test”,
“preferences”: {
“files.enableTrash”: false
}
}
}
},
“dependencies”: {
@theia/editor-preview”: “next”,
@theia/file-search”: “next”,
@theia/getting-started”: “next”,
@theia/git”: “next”,
@theia/java”: “next”,
@theia/json”: “next”,
@theia/markers”: “next”,
@theia/messages”: “next”,
@theia/navigator”: “next”,
@theia/outline-view”: “next”,
@theia/preferences”: “next”,
@theia/search-in-workspace”: “next”,
@theia/terminal”: “next”,
@theia/textmate-grammars”: “next”,
@theia/tslint”: “next”,
@theia/typescript”: “next”,
“typescript”: “next”,
@theia/plugin-ext”: “next”,
@theia/plugin”: “next”,
@theia/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”: {
@theia/cli”: “next”
}
}

What if you try with THEIA_WEBVIEW_EXTERNAL_ENDPOINT=localhost?

{{localhost}} won’t do anything {{…}} is a placeholder

It 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 it

Also 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.