senecajs / seneca

A microservices toolkit for Node.js.
http://senecajs.org
MIT License
3.95k stars 314 forks source link

act method times out without proper response callback function #918

Open mauricefaeh opened 1 year ago

mauricefaeh commented 1 year ago

Hi, first I'd like to thank you for this framework.

I've just started to use it and I'm going through the quick guide tutorial on your website.

I thought I'd let you know, that simply using console.log as the callback function of the Seneca.act method leads to time outs. The simple way to work around this is using a proper function(err, response) { console.log(response) }.

mauricefaeh commented 1 year ago

I thought I'd add the code here:

var seneca = require('seneca')();

seneca.add(
    {role: 'test'}, 
    function(msg, respond){
        var result = msg.text;
        console.log(result);
    }
);

seneca.act(
    {role: 'test', text: "hello bug"}, 
    console.log
);

And the terminal output here:

{"kind":"plugin","case":"READY","name":"transport","level":300,"isot":"2023-05-01T17:03:54.967Z","when":1682960634967,"level_name":"info","seneca_id":"pjvw5cacy1lo/1682960634943/2812/3.30.0/-","seneca_did":"3b7w","plugin_name":"transport"} hello bug {"notice":"seneca: [TIMEOUT] Action role:test timed out. Timeout was: 22222 (start: 1682960634971, end: 1682960657250. Message was: { role: 'test', text: 'hello bug' }.","code":"action_timeout","err":{"eraro":true,"orig":null,"code":"action_timeout","seneca":true,"package":"seneca","msg":"seneca: [TIMEOUT] Action role:test timed out. Timeout was: 22222 (start: 1682960634971, end: 1682960657250. Message was: { role: 'test', text: 'hello bug' }.","details":{"timeout":22222,"start":1682960634971,"end":1682960657250,"message":{"role":"test","text":"hello bug"},"pattern":"role:test","legacy_string":"[TIMEOUT] ","plugin":{}},"callpoint":"at Object.act_tm [as ontm] (/Users/ab/Documents/cd/ef/gh/ik/development/seneca/node_modules/seneca/lib/act.js:82:52)"},"actid":"h1s8fsgav1k2/hadtkr5rqu54","msg":{"role":"test","text":"hello bug"},"meta":{"start":1682960634963,"mi":"h1s8fsgav1k2","tx":"hadtkr5rqu54","id":"h1s8fsgav1k2/hadtkr5rqu54","version":"0.1.0","sync":true,"remote":false,"timeout":22222,"instance":"pjvw5cacy1lo/1682960634943/2812/3.30.0/-","tag":"-","seneca":"3.30.0","custom":{},"plugin":{"name":"root$","fullname":"root$"},"parents":[],"trace":[],"sub":null,"data":null,"err":null,"err_trace":null,"error":true,"empty":null,"pattern":"role:test","action":"action_8","end":1682960657258},"actdef":{"raw":{"role":"test"},"plugin_name":"root$","plugin_fullname":"root$","plugin":{"name":"root$","fullname":"root$"},"sub":false,"client":false,"fixed":{},"custom":{},"pattern":"role:test","msgcanon":{"role":"test"},"id":"action_8","name":"action","priorpath":"","rules":{}},"client":false,"listen":false,"transport":{},"kind":"act","case":"ERR","duration":22295,"level":500,"isot":"2023-05-01T17:04:17.259Z","when":1682960657259,"level_name":"error","seneca_id":"pjvw5cacy1lo/1682960634943/2812/3.30.0/-","seneca_did":"f71e","plugin_name":"root$","pattern":"role:test","action":"action_8","idpath":"hadtk.h1s8f"} Error: seneca: [TIMEOUT] Action role:test timed out. Timeout was: 22222 (start: 1682960634971, end: 1682960657250. Message was: { role: 'test', text: 'hello bug' }. at errormaker (/Users/ab/Documents/cd/ef/gh/ik/development/seneca/node_modules/eraro/eraro.js:112:15) at Object.act_tm [as ontm] (/Users/ab/Documents/cd/ef/gh/ik/development/seneca/node_modules/seneca/lib/act.js:82:52) at Timeout.timeout_check [as _onTimeout] (/Users/ab/Documents/cd/ef/gh/ik/development/seneca/node_modules/gate-executor/gate-executor.js:165:26) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7) { eraro: true, orig: null, code: 'action_timeout', seneca: true, package: 'seneca', msg: "seneca: [TIMEOUT] Action role:test timed out. Timeout was: 22222 (start: 1682960634971, end: 1682960657250. Message was: { role: 'test', text: 'hello bug' }.", details: { timeout: 22222, start: 1682960634971, end: 1682960657250, message: { role: 'test', text: 'hello bug' }, pattern: 'role:test', legacy_string: '[TIMEOUT] ', plugin: {} }, callpoint: 'at Object.act_tm [as ontm] (/Users/ab/Documents/cd/ef/gh/ik/development/seneca/node_modules/seneca/lib/act.js:82:52)' } null Meta { start: 1682960634963, mi: 'h1s8fsgav1k2', tx: 'hadtkr5rqu54', id: 'h1s8fsgav1k2/hadtkr5rqu54', version: '0.1.0', gate: undefined, fatal: undefined, closing: undefined, sync: true, local: undefined, remote: false, timeout: 22222, instance: 'pjvw5cacy1lo/1682960634943/2812/3.30.0/-', tag: '-', seneca: '3.30.0', dflt: undefined, custom: {}, plugin: { name: 'root$', tag: undefined, fullname: 'root$' }, prior: undefined, caller: undefined, parents: [], trace: [], sub: null, data: null, err: null, err_trace: null, error: true, empty: null, pattern: 'role:test', client_pattern: undefined, action: 'action_8', end: 1682960657258 } {"kind":"notice","data":"hello pjvw5cacy1lo/1682960634943/2812/3.30.0/-","level":300,"isot":"2023-05-01T17:04:17.263Z","when":1682960657263,"level_name":"info","seneca_id":"pjvw5cacy1lo/1682960634943/2812/3.30.0/-"}