Error: No such function: only in production mode


My App is running perfectly in debug mode but when I run it in production mode I get “Error: No such function: canAddMore”. Here is the JS code I have…

Template.fbRegister.helpers ({
	jobCount : function() {
		return Session.get("jobCount");
	eduCount : function() {
		return Session.get("eduCount");
	moreThanOneJob : function() {
		return Session.get('jobCount').length > 1
	moreThanOneEdu : function() {
		return Session.get('eduCount').length > 1
	canAddMore : function(count) {
		return count.length <= 2

And here is the HTML code …

{{#if canAddMore jobCount}}<a class="normal-link add-job">+ Add another Job</a>{{/if}}

What am I doing wrong here?

Any help would be appreciated. Thanks.


Does calling any of the other functions work? e.g moreThanOneEdu?


Yes they all do. I am getting errors in the functions to which I am passing a variable from the Template.


Not ideal, but as a workaround, you could try referencing jobCount from within canAddMore via Template.instance().jobCount.get() (assuming it’s a reactive var?) if the parameter is an issue.

No idea what the problem is sorry.


You are missing a bunch of semi colons. It’s possible this is working in debug but is being broken by minification.


You could be right. I guess I’ll have to go through all my JS files to see how many I’ve missed, fix them and try again. Thanks for that.
The silliest of things.


It seems as if the last comma shouldn’t be there after canAddMore.