Question

For some reason my dustjs custom filters have just stopped working on the production server, even though they work fine on my local machine. Anyone have any thoughts as to why this might be happening? I am using dustjs-linkedin v. 2.3.5.

What my filters look like (located in my main server.js file):

dust.filters.uppercase = function (value) {
    return String(value).toUpperCase();
};

dust.filters.ucwords = function (value) {
    return String(value).replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g, function($1) {
        return $1.toUpperCase();
    });
};

dust.filters.money = function (value) {
    return parseFloat(value).toFixed(2);
};

UPDATE: I really need this fixed, and am at a loss as to why this would work locally, but not on my server (this used to work just fine). Unfortunately, I didn't notice when it stopped working and have made MANY updates. Any ideas would be GREATLY appreciated.

Here are the app dependencies from my package.json:

"dependencies": {
    "express": "3.4.8",
    "socket.io": "0.9.16",
    "dustjs-linkedin": "2.3.x",
    "dustjs-helpers": "1.2.0",
    "consolidate": "0.10.0",
    "mongoose": "3.8.x",
    "node-uuid": "1.4.1",
    "express-form": "0.10.1",
    "bcrypt-nodejs": "0.0.3",
    "subdomain": "0.1.0",
    "gm": "1.14.x",
    "connect-mongo": "0.4.1",
    "nodemailer": "0.6.5"
}

ANOTHER UPDATE: I have added a console.log('money'); to the money filter and it logs every time it is run locally just fine, but never logs anything to the console on the production end. This leads me to believe that the custom filters are not being added on the production server for some reason.

YET ANOTHER UPDATE: I literally added the filters to the dust source code, and they still wont run on the production server, but work fine locally. Could using NODE_ENV somehow be causing something to mess up in dust?

Was it helpful?

Solution

Inspect the node_modules directory tree. My guess is you will find two instances of dustjs-linkedin. Your filters will be in one but you are using the other one. Something else is dragging in the other copy based on a different version.

OTHER TIPS

I think it happened because you have updated some packages to more recent versions. I have similiar thing with nodemailer package upgrade from 0.7.1 to 1.0.2 versions Can you prodive the dependecies hash of package.json file?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top