arnoudkooi/sn-scriptsync

Could not connect to websocket

lukasz-kuch opened this issue · 16 comments

I have the latest version of vs code and sn-scriptsync. SN Utils chrome extension - VS Script Sync is enabled. SN-scriptsync is running, unfortunately, the connection failed. Cannot also access http://localhost:1978 - error not found.

Do you see Upgrade Required when opening http://localhost:1978/ in browser, soes the helper tab open, console errors?

When opening http://localhost:1978 I get "This site can’t be reached". Helper tab open with following messegaes: "Could not connect to WebSocket. Check if VS Code is running and wait for connection or reload the page".
Console errror from browser: "scriptsync.js:37 WebSocket connection to 'ws://127.0.0.1:1978/' failed: "

Are you sure it is running in VS Code, look at the bottom to check, click on it to start stop
image

Yes, it looks the same. I've used it some time ago and it worked fine. For few days it didn't work at all

image

Please do a reboot, reinstall of the extension and check the VS Code terminal for errors. We can setup a call to troubleshoot as well

Please see terminal error below:
Error: listen EACCES: permission denied 0.0.0.0:1977 at Server.setupListenHandle [as _listen2] (net.js:1301:21) at listenInCluster (net.js:1366:12) at Server.listen (net.js:1452:7) at Function.listen (c:\Users\KUCHARSKIL\.vscode\extensions\arnoudkooicom.sn-scriptsync-1.9.9\node_modules\express\lib\application.js:618:24) at startServers (c:\Users\KUCHARSKIL\.vscode\extensions\arnoudkooicom.sn-scriptsync-1.9.9\out\extension.js:217:25) at c:\Users\KUCHARSKIL\.vscode\extensions\arnoudkooicom.sn-scriptsync-1.9.9\out\extension.js:100:9 at E._executeContributedCommand (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:107932) at E._doExecuteCommand (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:107077) at E.executeCommand (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:106983) at Object.executeCommand (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:96:21346) at c:\Users\KUCHARSKIL\.vscode\extensions\arnoudkooicom.sn-scriptsync-1.9.9\out\extension.js:51:29 at E._executeContributedCommand (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:107932) at E.$executeContributedCommand (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:108370) at l._doInvokeHandler (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:12836) at l._invokeHandler (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:12520) at l._receiveRequest (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:11187) at l._receiveOneMessage (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:9973) at c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:8074 at fire (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:57:1836) at S.fire (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:15497) at c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:106:29764 at fire (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:57:1836) at S.fire (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:15497) at t._receiveMessage (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:20755) at c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:17641 at fire (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:57:1836) at acceptChunk (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:12862) at c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:12210 at Socket.v (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:106:13195) at Socket.emit (events.js:315:20) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at Socket.Readable.push (internal/streams/readable.js:223:10) at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) Error: listen EACCES: permission denied 0.0.0.0:1978 at Server.setupListenHandle [as _listen2] (net.js:1301:21) at listenInCluster (net.js:1366:12) at Server.listen (net.js:1452:7) at new WebSocketServer (c:\Users\KUCHARSKIL\.vscode\extensions\arnoudkooicom.sn-scriptsync-1.9.9\node_modules\ws\lib\websocket-server.js:76:20) at startServers (c:\Users\KUCHARSKIL\.vscode\extensions\arnoudkooicom.sn-scriptsync-1.9.9\out\extension.js:219:11) at c:\Users\KUCHARSKIL\.vscode\extensions\arnoudkooicom.sn-scriptsync-1.9.9\out\extension.js:100:9 at E._executeContributedCommand (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:107932) at E._doExecuteCommand (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:107077) at E.executeCommand (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:106983) at Object.executeCommand (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:96:21346) at c:\Users\KUCHARSKIL\.vscode\extensions\arnoudkooicom.sn-scriptsync-1.9.9\out\extension.js:51:29 at E._executeContributedCommand (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:107932) at E.$executeContributedCommand (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:108370) at l._doInvokeHandler (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:12836) at l._invokeHandler (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:12520) at l._receiveRequest (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:11187) at l._receiveOneMessage (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:9973) at c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:8074 at fire (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:57:1836) at S.fire (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:15497) at c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:106:29764 at fire (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:57:1836) at S.fire (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:15497) at t._receiveMessage (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:20755) at c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:17641 at fire (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:57:1836) at acceptChunk (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:12862) at c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:65:12210 at Socket.v (c:\Users\KUCHARSKIL\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:106:13195) at Socket.emit (events.js:315:20) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at Socket.Readable.push (internal/streams/readable.js:223:10) at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) TypeError [ERR_INVALID_ARG_TYPE]: The "mode" argument must be integer. Received an instance of Object at Object.copyFile (fs.js:1972:10) at Object.t.<computed> [as copyFile] (electron/js2c/asar_bundle.js:5:2242) at c:\Users\KUCHARSKIL\.vscode\extensions\arnoudkooicom.sn-scriptsync-1.9.9\out\ExtensionUtils.js:26:16 at c:\Users\KUCHARSKIL\.vscode\extensions\arnoudkooicom.sn-scriptsync-1.9.9\node_modules\mkdirp\index.js:49:26 at FSReqCallback.oncomplete (fs.js:184:5)

Seems to be an permission issue, do you have full rights? Could you try run vs code as an admin?

I've tried with admin permission on vs code but it didn't helped

Glad it's resolved. Did you remove the comment with the solution?

Accidently removed ;)
The solution worked for me as below:
The ports1977-1978 belonged to Protocol TCP Port Exclusion Ranges.
Checked using Powershell command:

netsh interface ipv4 show excluded port range protocol=tcp

I've free the ports using Powershell command:

net stop winnat

I have the almost same problem. In my case and using Mac, the helper tab does not open anymore. I get the widget in VS Code by clicking the save icon but when I do save in VS Code. I get this: "No WebSocket connection. Please open SN Utils helper tab in a browser via slashcommand /token"
I tried to find what using port 1977 and kill it, but it didn't help. I also tried to uninstall/reinstall both extension and VS Code addon, tried with other PC and browser (Brave), and it didn't help either.

@iCode18 there is a problem at the moment, please see this issue that describes a workaround.

@iCode18 there is a problem at the moment, please see this issue that describes a workaround.

Thanks, it is working now with the workaround solution but not the auto-refresh at preview window.
I know that you're working on a permanent fix, but I would just inform you about the preview issue as well.

The fix is now published upgrade instruction can you try and let me know?

You need to do a full page refresh before it will work