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

Getting Started - Various Issues #333

Open
cawoodm opened this issue Sep 2, 2019 · 2 comments
Open

Getting Started - Various Issues #333

cawoodm opened this issue Sep 2, 2019 · 2 comments

Comments

@cawoodm
Copy link

cawoodm commented Sep 2, 2019

Just following the guide http://senecajs.org/getting-started/ and various things not working (Windows 10; NodeJS v11):

  1. node math-tree.js --seneca.print.tree prints gobbledegook but no tree:
{"kind":"plugin","case":"ready","name":"transport","level":"info","actid":"9khk062to02h/2t03f921bu2o","plugin_name":"transport","pattern":"name:transport,plugin:define,role:seneca,seq:1,tag:undefined","seneca":"603h6fyvpfyg/1567440867027/10304/3.13.3/-","when":1567440867104}
{"kind":"plugin","case":"ready","name":"math","level":"info","actid":"1mqhs8vf7be5/7zpezv8kbx7h","plugin_name":"math","pattern":"name:math,plugin:define,role:seneca,seq:2,tag:undefined","seneca":"603h6fyvpfyg/1567440867027/10304/3.13.3/-","when":1567440867123}
{"kind":"notice","notice":"hello seneca 603h6fyvpfyg/1567440867027/10304/3.13.3/-","level":"info","seneca":"603h6fyvpfyg/1567440867027/10304/3.13.3/-","when":1567440867124} 
  1. curl -d '{"role":"math","cmd":"sum","left":1,"right":2}' http://localhost:10101/act similarly:
{"eraro":true,"orig":null,"code":"invalid_json","seneca":true,"package":"seneca","msg":"seneca: Invalid JSON: '{role:math,cmd:sum,left:1,right:2}'.","details":{"input":"'{role:math,cmd:sum,left:1,right:2}'"},"callpoint":"at IncomingMessage.<anonymous> (W:\\JavaScript\\microservices\\senecajs-test\\node_modules\\seneca-transport\\lib\\http.js:228:35)"}

Server prints:

["json-parse","req-body","'{role:math,cmd:sum,left:1,right:2}'","Unexpected token ' in JSON at position 0"]

Probably has something to do with how Windows/DOS handles quotes as this works:

curl -d "{\"role\":\"math\",\"cmd\":\"sum\",\"left\":1,\"right\":2}" http://localhost:10101/act
{"answer":3}
@cawoodm
Copy link
Author

cawoodm commented Sep 2, 2019

Also, many examples use console.log as the callback (e.g. .act('role:math,cmd:sum,left:1,right:2', console.log)) which is very confusing since the callback has 3 parameters and the 3rd one is very verbose. I guess back in the day when the signature was (error, response) this was not an issue but today you get pages of debug info and think it didn't work:

null { answer: 3 } { start: 1567442085780,
  end: 1567442085831,
  pattern: 'role:math',
  action: 'transport_client_8',
  mi: '1xs9xx9z57j5',
  tx: '5r7v54vs57xy',
  id: '1xs9xx9z57j5/5r7v54vs57xy',
  instance: 'soh9tjt21bel/1567442085713/13420/3.13.3/-',
  tag: '-',
  seneca: '3.13.3',
  version: '0.1.0',
  gate: undefined,
  fatal: undefined,
  local: undefined,
  closing: undefined,
  timeout: 22222,
  dflt: undefined,
  custom: {},
  plugin:
   { name: 'seneca_internal_client',
     tag: '-',
     fullname: 'seneca_internal_client' },
  prior: undefined,
  caller: undefined,
  parents: [],
  remote: false,
  sync: true,
  trace: [ { desc: [Array], trace: [] } ],
  sub: null,
  data: null,
  err: null,
  err_trace: null,
  error: false,
  empty: null,
  client_pattern: undefined }
{"kind":"notice","notice":"hello seneca soh9tjt21bel/1567442085713/13420/3.13.3/-","level":"info","seneca":"soh9tjt21bel/1567442085713/13420/3.13.3/-","when":1567442085837} 

@cawoodm
Copy link
Author

cawoodm commented Sep 2, 2019

node math-pin-service.js --seneca.log=plugin:math produces no log output at all.

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

1 participant