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

replacing THEIA_WEBVIEW_EXTERNAL_ENDPOINT with localhost can also cause security issues

[Manuel Benz]

And this is what my browser is telling me about the response:

[Manuel Benz]

request URL looks bogus, hostname is %7b%7Blocalhost%7B%7B, please remove {{ and }}, they are for placeholders

request URL looks bogus, hostname is %7b%7Blocalhost%7B%7B, please remove {{ and }}, they are for placeholders

[Manuel Benz]

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)

[Manuel Benz]

Theia’s log says:

root ERROR Failed to enable webview caching: ReferenceError: caches is not defined
at e. (http://0.0.0.0:3000/bundle.js:19:936404)
at http://0.0.0.0:3000/bundle.js:19:935948
at Object.next (http://0.0.0.0:3000/bundle.js:19:936053)
at http://0.0.0.0:3000/bundle.js:19:934965
at new Promise ()
at o (http://0.0.0.0:3000/bundle.js:19:934739)
at e.resolveCache (http://0.0.0.0:3000/bundle.js:19:936254)
at new e (http://0.0.0.0:3000/bundle.js:19:936189)
at Object.t.resolveInstance (http://0.0.0.0:3000/bundle.js:41:25916)
at http://0.0.0.0:3000/bundle.js:41:25066

[Manuel Benz]

So I guess to get this working, I need to get Theia running on localhost, right? Any ideas why localhost:3000 is not working at all?

[Manuel Benz]

And thanks a lot for your help!

Failed to enable webview caching: ReferenceError: caches is not defined

it would mean that you don’t run in secure context, i.e. not on localhost or https

did you try to run image as in theia-apps: https://github.com/theia-ide/theia-apps#how-to-use-theiaidetheia-image

there one can access it on localhost

dockerfile is here: https://github.com/theia-ide/theia-apps/tree/master/theia-docker

[Manuel Benz]

If I set both Theia and webview endpoint to 0.0.0.0 I get the following view:

[Manuel Benz]

[Manuel Benz]

[Manuel Benz]

It’s communicating to 0.0.0.0:80 might the port be the problem here?

[Manuel Benz]

If I set the webview endpoint to {{hostname}} I get an empty view and the following resposone:

[Manuel Benz]