code-server: Markdown Preview is not working

Issue is similar to https://github.com/cdr/code-server/issues/296 The fix in this issue is not applicable to me I think since I’m not running behind nginx.

  • Web Browser: Google Chrome
  • Local OS: Windows 10
  • Remote OS: Ubuntu 20.04

Steps to Reproduce

  1. Open any md file.
  2. Try previewing the document.

Nothing in the code-server logs, But on dev tools,

Uncaught (in promise) Error: Service Workers are not enabled. Webviews will not work. Try disabling private/incognito mode.
    at main.js:115
    at new Promise (<anonymous>)
    at main.js:115

I’m not accesing it in incognito mode.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 38 (16 by maintainers)

Most upvoted comments

For some odd reasons serverice workers won’t start in incognito…

I believe service workers are disabled in incognito in Firefox (IIRC)

Hmm quite odd indeed. The only way I can think of for the authority to be missing is if the host header is missing but we have used link successfully before so I am not sure.

There have been changes to the remote authority in the latest code so it is possible it will be fixed there.

Ohhhhh right I remember now that Chrome started rejecting the certificate for service workers even if you accept the certificate on that page. I am not sure if there is anything we can do from code-server’s side on this unfortunately. I think this is just a decision they made on the browser side so we are kinda stuck with it.

It might be wise to output some text when using --cert describing the limitations or maybe show a message in-browser if we can about the issue. Or maybe the move is to deprecate --cert and recommend something like mkcert?

Although personally to me it feels like a bug so maybe there is something upstream about it.

@jsjoeio It worked, when I add --cert. The link worked perfectly when use safari, the only thing need to do is to trust the certificat. Chrome not worked, I turn to Chrome Canary, and start it with --ignore-certificate-errors --ignore-urlfetcher-cert-request, finally it worked.

Can you deploy it to HTTPS? I believe many services offer this for free. Other than that, there isn’t much we can do since this is a browser limitation

I deployed it in HTTPS and it works as expected. Thanks @jsjoeio

Can you deploy it to HTTPS? I believe many services offer this for free. Other than that, there isn’t much we can do since this is a browser limitation

Great~

Might be unrelated but I have seen Issues like that while using private/incognito mode.

For some odd reasons serverice workers won’t start in incognito…

Edit: this seems only be true for firefox

Good call! You got it

Okay, I’ll try to update it once we have a new release. Can we reopen this issue? @jsjoeio