Closed spathon closed 9 years ago
It could be; Haraka plugins run in a vm sandbox and that might be causing the problem there.
I think someone else ran into this yesterday; if you upgrade the version of async that Haraka uses to 1.0.0, then it should work as I've just checked the async code and it now uses the more sensible Array.isArray(...) instead of trying to check the constructor.
Thanks for the fast reply it helped us.
So Haraka is basically merging my node_modules folder which means that I always have to use the same versions of the packages Haraka is using?
Are you planning to update async to version 1 and release a new version of Haraka soon?
So Haraka is basically merging my node_modules folder which means that I always have to use the same versions of the packages Haraka is using?
Huh? No - each node module has it's own node_modules directory, so it should be totally independent of your app.
Are you planning to update async to version 1 and release a new version of Haraka soon?
We don't have any plans for a release at the moment. But when we do, then I'll make sure that async is @1.0.0
Apparently not because we had async ~0.9.0 specified in our package json and the async in our node_modules folder is 0.9.2 but when calling async in our plugin it's using async 0.2.9 from Haraka (latest on npm 2.6.1). The array issue in async was fixed in version 0.3.0. Do you know why Haraka is using it's own async then?
It should depend on where your plugin is installed e.g. if you run haraka -i /etc/haraka, then your local node_modules folder for the plugins would be /etc/haraka/node_modules and any plugins in /etc/haraka/plugins would first use /etc/haraka/node_modules before using the versions supplied with Haraka.
See https://github.com/baudehlo/Haraka/blob/master/haraka.js#L8-L18
For some reason it don't it just loads the modules that haraka don't use
and process.env.HARAKA
is returning /var/www/haraka
where the installation is
Writing the full path from the plugin works var async = require('../../node_modules/async');
but var async = require('async');
uses harakas
The latest Haraka in baudehlo/master specifies async 0.9.0, which I recently updated. The latest release of Haraka still has 0.2.9. If you installed Haraka via npm, you'll still get the old version of async.
Yeah I noticed that but I guess this might be an issue for others in the future if any one tries to use a newer module than Haraka is using.
Right now I will just use var async = require('../../node_modules/async');
every time where I need async in my plugin
this might be an issue for others in the future
Since async is updated in master
, It won't be an issue after we release the next version of Haraka.
When using async.waterfall in exports.hook_queue we get
Error: First argument to waterfall must be an array of functions
For some reason inside async.waterfall
tasks.constructor !== Array
returns trueasync.waterfall works in a regular express app on the same server and we have tried with async (0.9.0 and 0.9.2) and node (0.10.38 and 0.12.4)
Is haraka somehow causing this?