Socket Hang Up | Weird error in the log


#1

This is my df:

$ df
Filesystem     1K-blocks     Used Available Use% Mounted on
overlay         50758760 26003864  24738512  52% /
tmpfs              65536        0     65536   0% /dev
tmpfs           15707236        0  15707236   0% /sys/fs/cgroup
/dev/rbd160       131072    18168     99928  16% /app
/dev/xvda1      50758760 26003864  24738512  52% /tmp
shm                65536        0     65536   0% /dev/shm
tmpfs             262144     2772    259372   2% /etc/hosts
/dev/xvdp1     104856620 19994940  81408372  20% /rbd/pnpm-volume/~~~~
/dev/xvdp1     104856620 19994940  81408372  20% /rbd/pnpm-volume/store/2/server
udev            15699280        0  15699280   0% /dev/tty
tmpfs           15707236        0  15707236   0% /proc/scsi
tmpfs           15707236        0  15707236   0% /sys/firmware
node v8.9.4, with pnpm

Installing...

ERROR  Unexpected token / in JSON at position 0

at parse                                                                     

at at /home/nvm/pnpm/lib/node_mo…  …server/lib/connectStoreController.js:69  

at throw                                                                     

at rejected                        …/server/lib/connectStoreController.js:5  

at _tickCallback                   internal/process/next_tick.js:188

What’s happening here? How can I fix it?


#2

What does your package.json file look like?


#3
{
  "name": "membercount",
  "description": "Member Count Discord Bot",
  "author": "@lieuwe_berg#8662",
  "main": "membercount.js",
  "license": "ISC",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node membercount.js"
  },
  "engines": {
    "node": "8.9.4"
  },
  "dependencies": {
    "dblapi.js": "^2.0.0",
    "discord.js": "^11.3.2",
    "express": "^4.16.3",
    "moment": "^2.22.1",
    "moment-duration-format": "^2.2.2",
    "npm": "^5.8.0",
    "quick.db": "^6.1.3"
  }
}

#4

Looks like your package.json is valid, so pnpm is probably trying to parse something as JSON that isn’t actually JSON. Unfortunately, I’m not sure what exactly that might be.


#5

Try to refresh your project from the console,
also try to remix the project and see if the new one works,
if still doesn’t then the problem may be related to your browser and as far as I know refreshing the page will show what’s wrong, sometimes losing connection hides a part of the code, especially when pasting.


#6

if you run enable-npm from the console, do you still see the error?


#7

Doing that gave me these errors, which I believe are the cause.

node v8.9.4, npm 5.6.0

Installing...

npm WARN deprecated libcipm@1.6.3: This version mistakenly dropped node@4 compatibility in a semver-patch release. Please stay on 1.6.2 or update to 2 or latest

npm WARN deprecated npm-registry-fetch@1.1.1: this version has a breaking change. use 1.1.0 or upgrade to latest

npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0

#8

Ignore them, just deprecated packages
update your packages if you want to get rid of them, they might be the dependencies of the packages themselves which only their authors can update.

Edit: let it finish installing first and it’ll be fine.

Example:
image


#9

Well the socks one is kinda needed as I’ve been getting an error about that, making my program non-funtionable. Trying to update it.

(node:2348) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 7): Error: socket hang up


#10

Currently seeming to be fixed. May error again later though.


#11

It came back about 10 hours ago. People told me that it’s glitch’s internet connection. Could this be because of the recent problems with glitch’s outage and it being slow? Both have been fixed and it seems fine now.


#12

It’s possible that Glitch is the problem, but that doesn’t seem very likely. If you add .catch() blocks to your promise handling, you should be able to get a better error message.


#13

The error isn’t helping me much. This is only happening to my bussiest project so I’m probably going to try a paid host and see how it does. Will stick to glitch with my other ones :wink:


#14

What’s the error you’re seeing now you’ve added the catch blocks per Tim’s suggestion?


#15

Could you maybe take a look at my project? I’ll DM you if you’re willing to do so.


#16

Someone told me this: “Yeah glitch blocks incoming requests once it hits 4000 in 1 hour”


#17

That’s right, but when that happens a request will return a 429 error response. See https://glitch.com/faq#restrictions


#18

Confirmed. This issue is because there’s not enough ram. I monitored the ram on my paid host and once it got to 95-100% the CPU started spiking and the error appeared. I upgraded the ram and it works fine again.

No hate to glitch or anything, I love it. :heart: