arj03 / ssb-browser-demo

A secure scuttlebutt client interface running in the browser
Other
58 stars 11 forks source link

Error: Could not connect to ssb-server :::8008 #329

Open raphael10-collab opened 2 years ago

raphael10-collab commented 2 years ago

Following the indications found here: https://people.iola.dk/arj/2020/03/04/how-to-setup-a-pub-for-ssb-browser/ this is my setup for ssb-browser-demo:

.ssb/config :

{
   "connections": {
     "incoming": {
       "net": [{ "port": 8008, "host": "::", "scope": "public", "transform": "shs", "external": ["grasp.deals"] }],
       "ws": [{ "port": 8989, "host": "::", "scope": "public", "transform": "shs", "external": ["grasp.deals"], "key": "/etc/letsencrypt/live/grasp.deals/privkey.pem", "cert": "/etc/letsencrypt/live/grasp.deals/cert.pem" }]
     },
     "outgoing": {
       "net": [{ "transform": "shs" }],
       "tunnel": [{ "transform": "shs" }]
     }
   },
   "logging": {
     "level": "info"
   },
   "plugins": {
     "ssb-device-address": true,
     "ssb-identities": true,
     "ssb-peer-invites": true,
     "ssb-tunnel": true,
     "ssb-partial-replication": true
   },
   "caps": {
     "shs": "dkM/GDXLOaQBOoTBe6n4/EQvyaGOUx5iEILKhOM5GrU="
   }
 }

(base) raphy@pc:~/ssb-browser-demo/node_modules/ssb-browser-core/browser.js :

const os = require('os')
const path = require('path')

// in browser this will be local storage
const dir = path.join(os.homedir(), ".ssb-lite")

//require('./core').init(dir)

require('./core').init(dir, {
  caps: {
   shs: 'dkM/GDXLOaQBOoTBe6n4/EQvyaGOUx5iEILKhOM5GrU='
  }
})

run-server.sh :

#!/bin/bash
while true; do
     sbot server --port 8008 >> log.txt 2>&1
     sleep 30
 done

I execute run-server.sh :

(base) raphy@pc:~$ screen sh ~/run-server.sh

And in another `screen` I execute `sbot publish --type contact --contact '@feedId=.ed25519' --following` :  

(base) raphy@pc:~/ssb-browser-demo$ sbot publish --type contact --contact '@feedId=.ed25519' --following
Error: Could not connect to ssb-server :::8008
Use the "start" command to start it.
Use --verbose option to see full error

Or :

(base) raphy@pc:~$ ssb-server start --logging.level=info
ssb-minimal-pub-server 15.1.0 /home/raphy/.ssb logging.level:info
my key ID: SIody49P5a+pVHegDPLNB2/VRYf5iL5ua1KDitPAjRo=.ed25519
plugin named:device-address is already loaded, skipping
plugin named:identities is already loaded, skipping
plugin named:peer-invites is already loaded, skipping
ssb-friends: stream legacy api used

Other info:

node: v16.15.0

O.S.: Ubuntu 20.04 Desktop

What's wrong with my configuration and settings ? How to make it work?

I also realized that I experience problems in installing and executing ssb-browser-demo:

(base) raphy@pc:~$ git clone https://github.com/arj03/ssb-browser-demo.git
Cloning into 'ssb-browser-demo'...
remote: Enumerating objects: 4878, done.
remote: Counting objects: 100% (512/512), done.
remote: Compressing objects: 100% (187/187), done.
remote: Total 4878 (delta 347), reused 470 (delta 324), pack-reused 4366
Receiving objects: 100% (4878/4878), 25.31 MiB | 3.15 MiB/s, done.
Resolving deltas: 100% (3546/3546), done.
(base) raphy@pc:~$ cd ssb-browser-demo/
(base) raphy@pc:~/ssb-browser-demo$ ls -lah
total 892K
drwxrwxr-x  7 raphy raphy 4.0K May 16 18:29 .
drwxr-xr-x 96 raphy raphy 4.0K May 16 18:29 ..
drwxrwxr-x  2 raphy raphy 4.0K May 16 18:29 assets
-rw-rw-r--  1 raphy raphy 5.4K May 16 18:29 browser.html
-rw-rw-r--  1 raphy raphy 3.1K May 16 18:29 click-catcher.js
-rwxrwxr-x  1 raphy raphy 1.3K May 16 18:29 convert-to-inline.sh
drwxrwxr-x  2 raphy raphy 4.0K May 16 18:29 css
-rwxrwxr-x  1 raphy raphy  902 May 16 18:29 dedupe.sh
-rw-rw-r--  1 raphy raphy  950 May 16 18:29 defaultprefs.json
-rw-rw-r--  1 raphy raphy  766 May 16 18:29 favicon.ico
drwxrwxr-x  8 raphy raphy 4.0K May 16 18:29 .git
-rw-rw-r--  1 raphy raphy   26 May 16 18:29 .gitignore
-rw-rw-r--  1 raphy raphy  50K May 16 18:29 hermies.png
drwxrwxr-x  2 raphy raphy 4.0K May 16 18:29 indexes
-rw-rw-r--  1 raphy raphy  269 May 16 18:29 LICENSE
-rw-rw-r--  1 raphy raphy 4.2K May 16 18:29 localprefs.js
-rw-rw-r--  1 raphy raphy  241 May 16 18:29 manifest.json
-rw-rw-r--  1 raphy raphy  42K May 16 18:29 messages.json
-rw-rw-r--  1 raphy raphy 4.4K May 16 18:29 net.js
-rw-rw-r--  1 raphy raphy 676K May 16 18:29 npm-shrinkwrap.json
-rw-rw-r--  1 raphy raphy 1.9K May 16 18:29 package.json
-rw-rw-r--  1 raphy raphy  706 May 16 18:29 profile.js
-rw-rw-r--  1 raphy raphy 6.2K May 16 18:29 README.md
-rw-rw-r--  1 raphy raphy 1.7K May 16 18:29 search.js
-rw-rw-r--  1 raphy raphy 2.0K May 16 18:29 ssb-singleton-setup.js
-rwxrwxr-x  1 raphy raphy   78 May 16 18:29 start-server.sh
drwxrwxr-x  2 raphy raphy 4.0K May 16 18:29 ui
-rw-rw-r--  1 raphy raphy 3.4K May 16 18:29 usergroups.js
-rw-rw-r--  1 raphy raphy 2.3K May 16 18:29 write-dist.js
(base) raphy@pc:~/ssb-browser-demo$ npm install
npm WARN deprecated @hapi/pinpoint@1.0.2: Moved to 'npm install @sideway/pinpoint'
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/formula@1.2.0: Moved to 'npm install @sideway/formula'
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/joi@16.1.8: Switch to 'npm install joi'
npm WARN deprecated highlight.js@9.18.5: Support has ended for 9.x series. Upgrade to @latest
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

> ssb-browser-demo@5.6.0 postinstall
> ./dedupe.sh

added 920 packages, and audited 921 packages in 9s

69 packages are looking for funding
  run `npm fund` for details

16 vulnerabilities (10 moderate, 5 high, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
(base) raphy@pc:~/ssb-browser-demo$ npm run build

> ssb-browser-demo@5.6.0 build
> mkdir -p build && NODE_ENV=production browserify -g envify -p esmify --full-paths ui/browser.js > build/bundle-ui.js && node write-dist.js

[BABEL] Note: The code generator has deoptimised the styling of /home/raphy/ssb-browser-demo/node_modules/@toast-ui/editor/dist/esm/index.js as it exceeds the max of 500KB.
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
(base) raphy@pc:~/ssb-browser-demo$ npx browserslist@latest --update-db

/home/raphy/ssb-browser-demo/node_modules/browserslist/update-db.js:37
  throw new BrowserslistError(
  ^
Error [BrowserslistError]: No lockfile found. Run "npm install", "yarn install" or "pnpm install"
    at detectLockfile (/home/raphy/ssb-browser-demo/node_modules/browserslist/update-db.js:37:9)
    at updateDB (/home/raphy/ssb-browser-demo/node_modules/browserslist/update-db.js:198:14)
    at Object.<anonymous> (/home/raphy/ssb-browser-demo/node_modules/browserslist/cli.js:40:3)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  browserslist: true
}
(base) raphy@pc:~/ssb-browser-demo$ npm install
npm WARN deprecated highlight.js@9.18.5: Support has ended for 9.x series. Upgrade to @latest

> ssb-browser-demo@5.6.0 postinstall
> ./dedupe.sh

added 6 packages, and audited 921 packages in 1s

69 packages are looking for funding
  run `npm fund` for details

16 vulnerabilities (10 moderate, 5 high, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
(base) raphy@pc:~/ssb-browser-demo$ npx browserslist@latest --update-db

/home/raphy/ssb-browser-demo/node_modules/browserslist/update-db.js:37
  throw new BrowserslistError(
  ^
Error [BrowserslistError]: No lockfile found. Run "npm install", "yarn install" or "pnpm install"
    at detectLockfile (/home/raphy/ssb-browser-demo/node_modules/browserslist/update-db.js:37:9)
    at updateDB (/home/raphy/ssb-browser-demo/node_modules/browserslist/update-db.js:198:14)
    at Object.<anonymous> (/home/raphy/ssb-browser-demo/node_modules/browserslist/cli.js:40:3)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  browserslist: true
}
arj03 commented 2 years ago

Hi Raphael

I havn't touched this project in a while. The first issue to figure out is why the server is not responding on port 8008 for the sbot publish. If that doesn't work, then none of the other is going to work. Maybe you can get some more info by adding the verbose options. Sadly the sbot server is unmaintained. For later projects like groupies I have moved to rooms.

I think the browserslist error should be harmless.

raphael10-collab commented 2 years ago

Hi Anders!

Port 8008 is now available (I forgot to open it)

The error message I get is now different:

(base) raphy@pc:~$ sbot publish --type contact --contact '@feedId=.ed25519' --following
undefined:7
     },
     ^

SyntaxError: Unexpected token } in JSON at position 611
    at JSON.parse (<anonymous>)
    at exports.parse (/home/raphy/.nvm/versions/node/v16.15.0/lib/node_modules/ssb-minimal-pub-server/node_modules/rc/lib/utils.js:15:17)
    at addConfigFile (/home/raphy/.nvm/versions/node/v16.15.0/lib/node_modules/ssb-minimal-pub-server/node_modules/rc/index.js:30:20)
    at Array.forEach (<anonymous>)
    at module.exports (/home/raphy/.nvm/versions/node/v16.15.0/lib/node_modules/ssb-minimal-pub-server/node_modules/rc/index.js:43:36)
    at module.exports (/home/raphy/.nvm/versions/node/v16.15.0/lib/node_modules/ssb-minimal-pub-server/node_modules/ssb-config/inject.js:6:12)
    at Object.<anonymous> (/home/raphy/.nvm/versions/node/v16.15.0/lib/node_modules/ssb-minimal-pub-server/bin.js:25:14)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)

Anyway... I've just trued to use the groupies project, which has a very interesting features: rooms

image

I tried to create a group, but didn't succeed when clicking Create Group

arj03 commented 2 years ago

That looks like there is an json error in your config. ssb-config is quite strick about those.

Check the console in groupies, it might reveal what the error is.