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

Error trying to run ./sbot publish #36

Open
murilopolese opened this issue Aug 20, 2020 · 5 comments
Open

Error trying to run ./sbot publish #36

murilopolese opened this issue Aug 20, 2020 · 5 comments

Comments

@murilopolese
Copy link

I run this pub on a docker container and the processes is running as follow:

$ docker ps
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS                    PORTS                    NAMES
a389d14bbc60        ahdinosaur/healer         "/bin/healer"            26 minutes ago      Up 26 minutes                                      healer
200a628f3ec9        ahdinosaur/ssb-pub        "/tini -- ssb-server…"   26 minutes ago      Up 51 seconds (healthy)   0.0.0.0:8008->8008/tcp   sbot

I can run ./sbot whoami and ./sbot invite.create 1.

In the past I managed to run ./sbot publish --type about --about @xzVNju0I2n3N7SlAc76BSx0HKAoUCkWwNu7vsuZNyNU=.ed25519 --name PUBNAME

But when I try to add a description or a name with whitespaces (therefore wrapped in ", right?) I get the following error:

./sbot publish --type about --about @pubid  --description "Everybody should have a pub, this is mine"

/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpcli/index.js:68
      throw err
      ^
TypeError: cb is not a function
    at /home/node/.npm-global/lib/node_modules/ssb-server/node_modules/ssb-db/minimal.js:201:7
    at EventEmitter.append (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/ssb-db/minimal.js:162:18)
    at Object.add (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/ssb-db/create.js:93:10)
    at apply (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc-validation/index.js:202:13)
    at Object.<anonymous> (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc-validation/index.js:86:14)
    at Object.hooked (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/hoox/index.js:10:15)
    at Object.localCall (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc/local-api.js:31:29)
    at Object.<anonymous> (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc/local-api.js:37:22)
    at Object.request (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc/stream.js:48:17)
    at PacketStream._onrequest (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/packet-stream/index.js:161:17)

What am I doing wrong this time?

@sunjam
Copy link

sunjam commented Nov 23, 2020

Just ran into the same error when attempting to publish a simple text message with sbot publish --type post --text "Hi Friends"

/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpcli/index.js:123
      throw err
      ^
{
  message: 'cb is not a function',
  name: 'TypeError',
  stack: 'TypeError: cb is not a function\n' +
    '    at /home/node/.npm-global/lib/node_modules/ssb-server/node_modules/ssb-db/minimal.js:201:7\n' +
    '    at EventEmitter.append (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/ssb-db/minimal.js:162:18)\n' +
    '    at Object.add (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/ssb-db/create.js:93:10)\n' +
    '    at apply (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc-validation/index.js:202:13)\n' +
    '    at Object.<anonymous> (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc-validation/index.js:86:14)\n' +
    '    at Object.hooked (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/hoox/index.js:10:15)\n' +
    '    at Object.localCall (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc/local-api.js:31:29)\n' +
    '    at Object.<anonymous> (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc/local-api.js:37:22)\n' +
    '    at Object.request (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc/stream.js:48:17)\n' +
    '    at PacketStream._onrequest (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/packet-stream/index.js:161:17)'

@clehner
Copy link

clehner commented Nov 27, 2020

TypeError: cb is not a function happens when the number of positional arguments doesn't match what the RPC command expected. That this happens when there are spaces in the description suggests that it is a shell quoting/escaping issue.
Looking into this ./sbot, I see it is generated by install.sh. It should be quoting the arguments properly. But this was fixed in daa3972 (2018-10-24). If you installed before that, you would have the broken version. Just edit the sbot script to change $@ to "$@".

@sunjam
Copy link

sunjam commented Nov 29, 2020

Resolved the issue for me. @murilopolese this is solved once you apply the fix to ./sbot

@murilopolese
Copy link
Author

Oh! Cool! Thanks a lot! 👍
I'll have a look tonight and report/close the issue!

@murilopolese
Copy link
Author

I have just pulled the latest docker image and in fact if I publish a single word it works but if I publish anything with a space it still breaks:

./sbot publish --type about --about @xzVNju0I2n3N7SlAc76BSx0HKAoUCkWwNu7vsuZNyNU=.ed25519 --description bananada
{
  "key": "%B3uNJ8/DsFkuy0PtLNeOXMuXa1IiL6v6dmyMr1arFe8=.sha256",
  "value": {
    "previous": "%1iDAmP0J1hMcJoktpTMGQHKy1mqIeOSDa8FFxRXw+6g=.sha256",
    "sequence": 15,
    "author": "@xzVNju0I2n3N7SlAc76BSx0HKAoUCkWwNu7vsuZNyNU=.ed25519",
    "timestamp": 1611128851431,
    "hash": "sha256",
    "content": {
      "type": "about",
      "about": "@xzVNju0I2n3N7SlAc76BSx0HKAoUCkWwNu7vsuZNyNU=.ed25519",
      "description": "bananada"
    },
    "signature": "EsYSXNtIgjbuHLRof494sNCYtsJhuQgamXzqNu0nyad0jYfhM7tEG9yOiwCK2A9L283sVMmoyMPcQ8Re7mdCDg==.sig.ed25519"
  },
  "timestamp": 1611128851432
}
./sbot publish --type about --about @xzVNju0I2n3N7SlAc76BSx0HKAoUCkWwNu7vsuZNyNU=.ed25519 --description "bananabanana.me pub"


/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpcli/index.js:123
      throw err
      ^
{
  message: 'cb is not a function',
  name: 'TypeError',
  stack: 'TypeError: cb is not a function\n' +
    '    at /home/node/.npm-global/lib/node_modules/ssb-server/node_modules/ssb-db/minimal.js:201:7\n' +
    '    at EventEmitter.append (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/ssb-db/minimal.js:162:18)\n' +
    '    at Object.add (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/ssb-db/create.js:93:10)\n' +
    '    at apply (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc-validation/index.js:199:15)\n' +
    '    at Object.<anonymous> (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc-validation/index.js:86:14)\n' +
    '    at Object.hooked (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/hoox/index.js:10:15)\n' +
    '    at Object.localCall (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc/local-api.js:31:29)\n' +
    '    at Object.<anonymous> (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc/local-api.js:37:22)\n' +
    '    at Object.request (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/muxrpc/stream.js:48:17)\n' +
    '    at PacketStream._onrequest (/home/node/.npm-global/lib/node_modules/ssb-server/node_modules/packet-stream/index.js:161:17)'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants