Code-server: Cannot copy in terminal Cannot read property 'writeText' of undefined

Created on 28 Aug 2019  路  10Comments  路  Source: cdr/code-server


  • code-server version: code-server2.preview.9-vsc1.37.0-linux-x86_64
  • OS Version: Ubuntu server 18.04 LTS
  • Clinet: mac os serria + chrome 75

    Description

When trying to copy from terminal, get Cannot read property 'writeText' of undefined

Steps to Reproduce

Just select a text in terminal and copy

bug

Most helpful comment

Are you accessing the IDE over HTTP? Chrome won't allow access to
the clipboard unless the page is either over HTTPS or localhost so
that might be what's happening here.

All 10 comments

Are you accessing the IDE over HTTP? Chrome won't allow access to
the clipboard unless the page is either over HTTPS or localhost so
that might be what's happening here.

Yes, I use http. But I don't know how to go back to https without configuring cert. I remember first version is default to https (just start the code-server and then https runs).

@code-asher

Yeah v2 defaults to http. You can pass --cert to enable https. If
you don't specify a path it will generate a self-signed
certificate for you.

@code-asher I and --cert but still can't use https, the browser console print:

workbench.web.api.js:1538 WebSocket connection to 'wss://localhost:7777/?reconnectionToken=26068b2f-1fc2-4dd5-9438-070581b170cf&reconnection=true&skipWebSocketFrames=false' failed: WebSocket opening handshake timed out

clear all data in chrome and problem solved.Thanks

This has nothing to do with http or https, since copy paste does work in files but not in terminal. Having the same issue...

@jdelrue Any success...same issue with me. Cleared browser data too.

Are you guys using latest chrome?

I believe the reason it doesn't work with http is because the terminal uses the new clipboard API while the editor view uses the DOM and so can use the older execCommand API. See https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand and https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API

Going to close unless you guys confirm you're using HTTPS.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KSXGitHub picture KSXGitHub  路  3Comments

sa7mon picture sa7mon  路  3Comments

tecosaur picture tecosaur  路  3Comments

nol166 picture nol166  路  3Comments

pchecinski picture pchecinski  路  3Comments