npm link shared mojits failed on 0.7.2

Hi again,

We have a dedicated repository(internal, not git) that stores shared mojits. By using npm link other projects can use those shared mojits, this has worked fine up to (including) 0.7.1, but switching to 0.7.2, the shared mojits can no longer be found by mojito, so I traced it to:


           if (!this._libs.fs.lstatSync(dir).isDirectory()) {

This directory checking must have failed for 'linked' mojits, can this restriction be removed or altered (eg add isSymbolicLink())?

Thank you.


  • ft
  • Aug 13, 2013
3 Replies
  • @ft, can you open an issue in https://github.com/yahoo/mojito/issues/new?

    @lzhan, @isao, can you guys look at this? It is related to https://github.com/yahoo/mojito/pull/1198

  • I have got another question... Sorry for not posting on a new thread, but somehow what I typed just doesn't show up, so I gave up after a few tries. Here it goes:

    I understand mojito now imposes an actionTimeout:

    The number of milliseconds that an action can run without calling ac.done or ac.error before Mojito logs a warning and invokes ac.error with a Timeout error.

    Currently we have a 'download file' functionality, which is implemented like this:

                    var res = ac.http.adapter.res;
                    var filestream = fs.createReadStream(pathToRead);
                    var fileName = path.basename(filestream.path);
                    res.setHeader('Content-disposition', 'attachment; filename='+fileName);
                    res.setHeader('Content-type', "application/octet-stream");              
                    filestream.on('data', function(chunk) {
                    filestream.on('end', function() {

    Since this bit of code does not use ac.done nor ac.error, mojito will generate an error message after 60 sec:

    error: (outputhandler.server): { [Error: Killing potential zombie context for Mojit type: Server, controller: Server, action: get_file_download] code: 408 }

    timers.js:103 if (!process.listeners('uncaughtException').length) throw e; ^ Error: Can't render headers after they are sent to the client. at ServerResponse.OutgoingMessage._renderHeaders (http.js:721:11) ...

    The final part (render header error) kills the server. So I am just wondering if there's a better way to do file downloads, or is setting actionTimeout (global config) to 0 the only way to go?

    Thanks for all your help so far!

  • That is explained in the github issue. In the issue we can see how to cancel the timeout for a particular request, instead of just trying to set actionTimeout to cero.

    That being said, the use case of downloading a file is not suitable for a mojit to deal with. Mojits are about logical pieces that works on server and client, downloading a file is just a server side routine not related to JS or HTML. In that case, I think your best shot is to create a middleware, you can define that middleware in application.json, and it can handle that particular type of requests without calling next(), which means that mojito dispatcher will never be executed if what you want is to send a file to the client.


Recent Posts

in Yahoo! Mojito