code-server version:info 2.1665-vsc1.39.2
info 3d5db8313a91f80dfc402450fd117b4e63f7711e
info x64
N.B. I am not sure that this issue is strictly related to the specific version of code-server. I had a similar experience with just running Java code from within the IDE on an EC2 VM even before. Now I can confirm that code snippets also misbehave.
I have built a Docker image with Java support (https://github.com/redhat-developer/vscode-java) which is also able to execute code snippets from many other languages (https://github.com/formulahendry/vscode-code-runner). Containers based on this image work equally well when run on my local macOS machine with latest versions of Firefox, Chrome, and Safari.
I run a container based on this same image on a VM in Amazon EC2. Using Firefox I am able to run code snippets supported by the code-runner extension and use vscode-java to execute Java applications or tests from within the VS Code.
Using the Chrome or Safari web browsers to connect to the same container, none of those worked. I see that extensions are being activated but nothing really happens when trying to execute code snippets or Java code.
Maybe there is something to be configured. I am not sure. Any recommendation how to get Chrome (and potentially Safari) working against a Docker container run on an EC2 VM would be highly appreciated.
t2.large Ubuntu VM in EC2.vscode-java) and/or running code snippets (code-runner) on top of this VM.I'll try this out as soon as I can but in the meantime here's a wild shot in the dark: is the URL somehow HTTP for Chrome/Safari but not Firefox? I've seen issues running tasks when service workers aren't available (which happens on HTTP).
Negative. The URL is always a http://... for all browsers. Currently, it's not secured in any way as I am running a multi-stage MVP and SSL would be a bit too much for the current stage. I also just spin up the container. There is no load balancer/reverse proxy whatsoever in between.
By the way, I can share a Dockerfile that may save few minutes on your side and just give you the opportunity to play around and observe. Would that help?
Yeah, that sounds great.
So here is the content of the Dockerfile. Few things to keep in mind:
org.example.App Java file and select Run Code. This will use the code-runner extension or create a groovy file and do the same. This will work well in Firefox (at least you will see that some class is not found). Nothing will happen once you try it in Chrome, Chromium or Safari.FROM codercom/code-server:latest
ENV PASSWORD=init1234
RUN sudo apt-get update && \
sudo apt-get install unzip zip curl openjdk-8-jdk maven -y
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
RUN curl -s get.sdkman.io | bash && \
/bin/bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk install groovy"
# Set up maven project
WORKDIR /home/coder
RUN mvn -B archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-simple \
-DarchetypeVersion=1.4 \
-DgroupId=org.example \
-DartifactId=my-project \
-Dversion=1.0-SNAPSHOT
# Install extensions
RUN code-server --install-extension marlon407.code-groovy && \
code-server --install-extension formulahendry.code-runner && \
code-server --install-extension vscjava.vscode-java-pack
WORKDIR /home/coder/my-project
RUN mvn test
ENTRYPOINT ["dumb-init", "code-server", "--host", "0.0.0.0", "/home/coder/my-project"]
I haven't ran this on EC2 yet but it seems like our Java extension is missing files. If I go into the extension and run (after installing npm):
npm install
./node_modules/.bin/gulp download_server
Then it activates properly. It remains to be seen whether this is the cause of the Chrome/Safari issues but I'm pretty confused because those files seemed to exist before. We really need to tackle improving our extension marketplace next I think.
I haven't ran this on EC2 yet but it seems like our Java extension is missing files. If I go into the extension and run (after installing
npm):npm install ./node_modules/.bin/gulp download_serverThen it activates properly. It remains to be seen whether this is the cause of the Chrome/Safari issues but I'm pretty confused because those files seemed to exist before. We really need to tackle improving our extension marketplace next I think.
On my side, going through the steps outlined above helped with getting the Java language support extension activated. However, the reported issue is still there, i.e. I cannot run Java code and code snippets through code-server hosted by a EC2 VM. After 30 min. the VSCode running in a Chrome browser still says "Activating Extensions..."
I opened the Developer tools in Chrome. There are errors and warnings. The warnings are still there with Firefox, there are no errors. I guess these would should be some hints as to what might be wrong.

On my side, going through the steps outlined above helped with getting the Java language support extension activated. However, the reported issue is still there, i.e. I cannot run Java code and code snippets through
code-serverhosted by a EC2 VM. After 30 min. the VSCode running in a Chrome browser still says "Activating Extensions..."I opened the Developer tools in Chrome. There are errors and warnings. The warnings are still there with Firefox, there are no errors. I guess these would should be some hints as to what might be wrong.
Ahh that's interesting! The undefined error there happens on insecure domains but I don't know exactly why yet. The fact that Firefox doesn't have that error but Chrome does seems to be a pretty big clue in the right direction.
It turns out I was able to replicate this locally using just the Dockerfile. On an insecure domain (I'm just using my hosts files to point to localhost since localhost itself is considered secure) Chromium doesn't work but Firefox does, and I see the same difference in errors you described.
I could have sworn I tested an insecure domain last Friday but I'm testing it now and it definitely isn't working so I must have imagined it. It just spins with "activation extensions".
Now, code-server works great on top of EC2 VMs even without a LB in front. Thank you so much, team! Highly appreciated.
Most helpful comment
I haven't ran this on EC2 yet but it seems like our Java extension is missing files. If I go into the extension and run (after installing
npm):Then it activates properly. It remains to be seen whether this is the cause of the Chrome/Safari issues but I'm pretty confused because those files seemed to exist before. We really need to tackle improving our extension marketplace next I think.