Skip to content
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

SyntaxError: Unexpected end of JSON input #453

Closed
haoteng10 opened this issue Apr 6, 2019 · 25 comments
Closed

SyntaxError: Unexpected end of JSON input #453

haoteng10 opened this issue Apr 6, 2019 · 25 comments
Labels
bug Something isn't working

Comments

@haoteng10
Copy link

haoteng10 commented Apr 6, 2019

  • code-server version: 1.691-vsc1.33.0
  • OS Version: Ubuntu 18.04 LTS Minimal, Google Cloud

Description

When I tried to run the code-server command, it gives me this error:

WARN Uncaught Exception: Error: Unexpected end of JSON input

SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at pfs_1.readFile.then.contents (/home/travis/build/codercom/code-server/packages/server/build/bootstrap-fork.js.gz:76703:45)
at
at Timeout.setTimeout [as _onTimeout] (/home/travis/build/codercom/code-server/packages/server/build/bootstrap-fork.js.gz:53086:31)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)

Also, when I tried to connect the website ignoring the error, I received the error x.x.x.x refused to connect. (Okay. This is a different issue. I need to specify the specific IP address for the code-server to run on instead of 0.0.0.0)

Steps to Reproduce

  1. Extract the code-server and put it in bin.
  2. Run command sudo code-server -p 80
@haoteng10 haoteng10 added the bug Something isn't working label Apr 6, 2019
@kylecarbs
Copy link
Member

That error likely isn't causing the refused to connect.

@haoteng10
Copy link
Author

@kylecarbs The syntax error should be ignored?

@axelaxelsson
Copy link

I get same error

code-server v1.604-vsc1.32.0
OS version: Debian GNU/Linux 9.8 (stretch)

@malikowy
Copy link

malikowy commented Apr 7, 2019

the same issue, using AWS EC2

ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20190212 (ami-05af84768964d3dc0)

@nlighteneddesign
Copy link

I am getting a similar error in my docker logs:

    at JSON.parse (<anonymous>)
    at pfs_1.readFile.then.contents (/src/packages/server/build/bootstrap-fork.js.gz:95779:45)
    at <anonymous>
    at Timeout.setTimeout [as _onTimeout] (/src/packages/server/build/bootstrap-fork.js.gz:71026:31)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)
INFO  WebSocket closed / {"client":2,"code":1001}

I am trying to run this using docker-compose. The editor loads for me on the port specified, but the project files are not visible.

  vscode:
    container_name: vscode
    restart: unless-stopped
    image: codercom/code-server
    user: root
    ports:
      - "8443:8443"
    volumes:
      - "/srv/docker/hass-config:/home/coder/project"
    command: "code-server --allow-http --no-auth"

@fabiopolimeni
Copy link

Same problem here in ArchLinux as self hosting.
code-server v1.691-vsc1.33.0

I can access the IDE pointing at localhost:8443 but it doesn't start up on the right directory and I don't seem to be able open any other directory but the current one (which happens to be the one where the vscode-server binary file is).

@joshddavis
Copy link

Also getting the same error with Ubuntu 18.04
code-sever 1.691-vsc1.33.0

@curlybraces
Copy link

curlybraces commented Apr 7, 2019

Im also getting this same WARN Uncaught Exception: Error: Unexpected end of JSON input

using Ubuntu 16.04 using the newest binary release

@fabiopolimeni
Copy link

fabiopolimeni commented Apr 8, 2019

Same problem here in ArchLinux as self hosting.
code-server v1.691-vsc1.33.0
I can access the IDE pointing at localhost:8443 but it doesn't start up on the right directory and I don't seem to be able open any other directory but the current one (which happens to be the one where the vscode-server binary file is).

For me, I don't know how exactly, adding certs and key and forcing an initial directory with -d option, made the error go away.

The editor seems to work properly now.

I am left with another little error Port scanning will not be available: spawn netstat ENOENT. But this is unrelated.

@code-asher
Copy link
Member

code-asher commented Apr 8, 2019

Just pushed a commit that should permanently resolve the JSON message, but it's very unlikely to have caused any issues (it's just about trying to read the backup workspaces JSON file in order to delete empty workspace storage).

I also made the port scanning message more explicit. It now says "Port scanning will not be available because netstat is not installed" and it's been downgraded to a warning. We'll probably need to add some documentation on why we have port scanning and what you lose if you don't have it (assuming we don't replace it: #382).

@malikowy
Copy link

malikowy commented Apr 8, 2019

When it will be available in any release file?

@joshddavis
Copy link

Same problem here in ArchLinux as self hosting.
code-server v1.691-vsc1.33.0
I can access the IDE pointing at localhost:8443 but it doesn't start up on the right directory and I don't seem to be able open any other directory but the current one (which happens to be the one where the vscode-server binary file is).

For me, I don't know how exactly, adding certs and key and forcing an initial directory with -d option, made the error go away.

The editor now seems to work properly now.

I am left with another little error Port scanning will not be available: spawn netstat ENOENT. But this is unrelated.

can you post an example of the command you're using to get it working? ive been unable to get it running so far.

@fabiopolimeni
Copy link

Same problem here in ArchLinux as self hosting.
code-server v1.691-vsc1.33.0
I can access the IDE pointing at localhost:8443 but it doesn't start up on the right directory and I don't seem to be able open any other directory but the current one (which happens to be the one where the vscode-server binary file is).

For me, I don't know how exactly, adding certs and key and forcing an initial directory with -d option, made the error go away.
The editor now seems to work properly now.
I am left with another little error Port scanning will not be available: spawn netstat ENOENT. But this is unrelated.

can you post an example of the command you're using to get it working? ive been unable to get it running so far.

Sure, as simple as this: code-server -p 8443 -d /home/<name>/vscode --cert=/home/<name>/certs/<hostname>.crt --cert-key=/home/<name>/certs/<hostname>.key -o.

@sr229
Copy link
Contributor

sr229 commented Apr 9, 2019

This has to deal with how the JSONs were generated in .code-server. This may need further investigation

@nlighteneddesign
Copy link

I got it working by changing the volume to:

    container_name: vscode
    restart: unless-stopped
    image: codercom/code-server
    user: root
    ports:
      - "8443:8443"
    volumes:
      - /srv/docker/project:/root/project/code-server/project
    command: "code-server --allow-http --no-auth"

@okabamac
Copy link

When are expecting a fix for this? I've got the same problem with GCP, Digital Ocean and Vultr running Ubuntu 16/18 and it sure seems it is coming from code-server

@Meshkati
Copy link

Same for me on running Docker release. When I use binaries I don't have this problem ( but it crashes after some minutes with different error )

@whmrtm
Copy link

whmrtm commented Apr 11, 2019

When I use binaries on Ubuntu 16.04, it has the same problem. Using the latest release.

@g3ortega
Copy link

Same issue:

Using Ubuntu 18.04 on Digital Ocean and running code-server binary

SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at pfs_1.readFile.then.contents (/home/travis/build/codercom/code-server/packages/server/build/bootstrap-fork.js.gz:76703:45)
at
at Timeout.setTimeout [as _onTimeout] (/home/travis/build/codercom/code-server/packages/server/build/bootstrap-fork.js.gz:53086:31)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)

@parasvasishth
Copy link

Same issue:

Using Ubuntu 18.04 on Digital Ocean and running code-server binary

SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at pfs_1.readFile.then.contents (/home/travis/build/codercom/code-server/packages/server/build/bootstrap-fork.js.gz:76703:45)
at
at Timeout.setTimeout [as _onTimeout] (/home/travis/build/codercom/code-server/packages/server/build/bootstrap-fork.js.gz:53086:31)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)

same

@acmu
Copy link

acmu commented Apr 12, 2019

Same issue:
Using Ubuntu 18.04 on Digital Ocean and running code-server binary

SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at pfs_1.readFile.then.contents (/home/travis/build/codercom/code-server/packages/server/build/bootstrap-fork.js.gz:76703:45)
at
at Timeout.setTimeout [as _onTimeout] (/home/travis/build/codercom/code-server/packages/server/build/bootstrap-fork.js.gz:53086:31)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)

same

same here, but my ubuntu is 16.04

@ipv1337
Copy link

ipv1337 commented Apr 13, 2019

I guess I'm the only crazy one trying to get this working in my Fedora29 workspace container, but it seems I'm getting the same errors everyone above is getting that shouldn't be related Fedora as everyone here seems to be running Ubuntu.

I'm just downloading the latest binaries and tossing it into my container which technically should work otherwise.

@zhumeme
Copy link

zhumeme commented Apr 13, 2019

same error in my Ubuntu18.04.

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at pfs_1.readFile.then.contents (/home/travis/build/codercom/code-server/packages/server/build/bootstrap-fork.js.gz:76703:45)
    at <anonymous>
    at Timeout.setTimeout [as _onTimeout] (/home/travis/build/codercom/code-server/packages/server/build/bootstrap-fork.js.gz:53086:31)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)

@Lin-boy
Copy link

Lin-boy commented Apr 15, 2019

same error in my Ubuntu18.04 AWS EC2. The latest binaries 1.604-vsc1.32.0/code-server1.604-vsc1.32.0-linux-x64.
c28293ddf9668b83494bb1b9467323d

@code-asher
Copy link
Member

Just made a release that contains the fix.

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
Development

No branches or pull requests