Skip to content

without-browser-env-var variable is not sent to vscode server #4721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
migolo opened this issue Jan 10, 2022 · 12 comments · Fixed by #4776 or #4792
Closed

without-browser-env-var variable is not sent to vscode server #4721

migolo opened this issue Jan 10, 2022 · 12 comments · Fixed by #4776 or #4792
Assignees
Labels
bug Something isn't working
Milestone

Comments

@migolo
Copy link

migolo commented Jan 10, 2022

without-browser-env-var is not specified, so tools like create-react-app attempts to start a browser at the vscode defined path and crashes

Sorry for the incomplete data, I will try to edit the issue with the logs and paths appended later

OS/Web Information

  • Web Browser: Any (Chrome)
  • Local OS: Mac OSX
  • Remote OS: Ubuntu
  • Remote Architecture: amd64
  • code-server --version: 4.0.1

Steps to Reproduce

  1. Run npm start on integrated terminal for code-server
  2. Crashes immediately trying to look at browser.sh from vscode

Expected

npm start should start, not crash.

Actual

Crashes

Notes

This is the line that gets appended to the browser env so react crashes (as there should not be a browser env file) https://github.com/microsoft/vscode/blob/6249dab4fe849d0ad11500fabd28ddc204ef12da/src/vs/server/extensionHostConnection.ts#L60

code-server version 3.12.0 doesn't crash

This issue can be reproduced in VS Code: No

@jsjoeio jsjoeio added the needs-investigation This issue needs to be further investigated label Jan 12, 2022
@jsjoeio jsjoeio added this to the On Deck milestone Jan 12, 2022
@jsjoeio
Copy link
Contributor

jsjoeio commented Jan 12, 2022

Thanks for reporting this! Running code-server 4.0.1 locally, this tries to open in my browser (and succeeds) since it's running on the same machine.

Now with a remote machine, I tested and cannot reproduce.

Video

Screen.Recording.2022-01-12.at.10.22.12.AM.mov

@code-asher can you reproduce?

@migolo
Copy link
Author

migolo commented Jan 12, 2022

You can see me reproducing the issue,
https://user-images.githubusercontent.com/207846/149213757-43c72cc6-976b-4557-9c35-0354c2f033c3.mov

Starting the development server...

node:events:368
      throw er; // Unhandled 'error' event
      ^

Error: spawn /usr/lib/code-server/vendor/modules/code-oss-dev/bin/helpers/browser.sh ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /usr/lib/code-server/vendor/modules/code-oss-dev/bin/helpers/browser.sh',
  path: '/usr/lib/code-server/vendor/modules/code-oss-dev/bin/helpers/browser.sh',
  spawnargs: [ 'http://localhost:3000/app' ]
}

@jsjoeio
Copy link
Contributor

jsjoeio commented Jan 12, 2022

Thanks for the video! It looks like you're using custom environment variables when running your React app. What does .env.development have in it?

image

What happens if you add BROWSER=false that .env file?

@migolo
Copy link
Author

migolo commented Jan 12, 2022

Adding the BROWSER=false to the env file works!

@migolo
Copy link
Author

migolo commented Jan 12, 2022

So, yeah for the moment I can use that as a workaround, but, probably would be helpful to know why the $BROWSER env is populated?

$ echo $BROWSER
/usr/lib/code-server/vendor/modules/code-oss-dev/bin/helpers/browser.sh

@jsjoeio
Copy link
Contributor

jsjoeio commented Jan 13, 2022

Weird that I don't see that...but this is locally on my macOS where code-server is installed with Homebrew.

image

@code-asher any ideas?

@migolo
Copy link
Author

migolo commented Jan 13, 2022

Oh! It's not on the usual terminal, is inside the vscode terminal, if I ssh into the remote host $BROWSER env is not set

@jsjoeio
Copy link
Contributor

jsjoeio commented Jan 13, 2022

Ah, I misunderstood. I thought it was adding that to your global environment for some reason. Thanks for clarifying. I see it now!

image

@jsjoeio
Copy link
Contributor

jsjoeio commented Jan 13, 2022

@code-asher do you have any thoughts on this?

@code-asher
Copy link
Member

code-asher commented Jan 13, 2022 via email

@migolo
Copy link
Author

migolo commented Jan 14, 2022

Is there a way to add in the configuration the ability to send without-browser-env-var flag so $BROWSER flag is not set?

@code-asher
Copy link
Member

code-asher commented Jan 14, 2022 via email

code-asher added a commit to code-asher/code-server that referenced this issue Jan 20, 2022
VS Code moves this as part of their packaging task.  We will probably
want to look into using theirs instead of replicating it.

Fixes coder#4721
code-asher added a commit to code-asher/code-server that referenced this issue Jan 20, 2022
VS Code moves this as part of their packaging task.  We will probably
want to look into using theirs instead of replicating it.

Fixes coder#4721
code-asher added a commit to code-asher/code-server that referenced this issue Jan 20, 2022
VS Code moves this as part of their packaging task.  We will probably
want to look into using theirs instead of replicating it.

Fixes coder#4721
code-asher added a commit to code-asher/code-server that referenced this issue Jan 20, 2022
VS Code moves this as part of their packaging task.  We will probably
want to look into using theirs instead of replicating it.

Fixes coder#4721
@code-asher code-asher self-assigned this Jan 20, 2022
@code-asher code-asher added bug Something isn't working and removed needs-investigation This issue needs to be further investigated labels Jan 20, 2022
@code-asher code-asher modified the milestones: On Deck, 4.0.2 Jan 20, 2022
code-asher added a commit that referenced this issue Jan 21, 2022
VS Code moves this as part of their packaging task.  We will probably
want to look into using theirs instead of replicating it.

Fixes #4721
TinLe pushed a commit to TinLe/code-server that referenced this issue Apr 23, 2022
VS Code moves this as part of their packaging task.  We will probably
want to look into using theirs instead of replicating it.

Fixes coder#4721
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants