Render failed for template: templateFunction is not a function
-
I'm running NodeBB 1.5.3 on AWS and I keep getting this error in the logs
Render failed for template /edx/app/community/nodebb-platform/build/public/templates/footer.jst: TypeError: Render failed for template /edx/app/community/nodebb-platform/build/public/templates/footer.jst: templateFunction is not a function at runtime (/edx/app/community/nodebb-platform/node_modules/benchpressjs/build/lib/runtime.js:64:16) at render (/edx/app/community/nodebb-platform/node_modules/benchpressjs/build/lib/express.js:11:20) at Object.__express (/edx/app/community/nodebb-platform/node_modules/benchpressjs/build/lib/express.js:33:5) at /edx/app/community/nodebb-platform/src/webserver.js:134:15 at /edx/app/community/nodebb-platform/src/middleware/index.js:205:12 at nextTask (/edx/app/community/nodebb-platform/node_modules/async/dist/async.js:5297:14) at next (/edx/app/community/nodebb-platform/node_modules/async/dist/async.js:5304:9) at /edx/app/community/nodebb-platform/node_modules/async/dist/async.js:906:16 at /edx/app/community/nodebb-platform/src/file.js:101:3 at FSReqWrap.oncomplete (fs.js:153:5)
Can someone please tell me whey this occurs?
This occurs on one of the servers in a load balanced environment where there are 2 servers running. If I increase the server count to 4 then out of those 4, 2 servers are having this exception. Servers in our load balanced environment are using redis for pub/sub, MongoDB as the primary database. Sticky sessions are enabled with stickiness time set to 30 seconds. The servers use the same AMI image.
-
Run
./nodebb build
, restart, and try again. -
Oh, you're on an old version of NodeBB. This is fixed in the latest version, you should really try updating. I can't help you otherwise than point you to the commits which fix the issue.
-
@asamolion Here are the changes:
Precompile all templates by pitaj · Pull Request #6649 · NodeBB/NodeBB
Benchpress compilation is 33x faster now Native module with JS fallback and pre-built binaries Dev template build is <1sec now Minified template build is ~5sec (uglify accounts for almost all)
GitHub (github.com)
Just use the latest version of benchpressjs (not 1.2.3)