Helper cannot be found


#1

We just started experience this issue on a new developer coming onto our project. So it’s working on all previous developers’ environments, but not on this new one.

This is the error we’re getting in console:

Uncaught Error: Compile Error: humanDate is not a helper

It’s being called in an hbs template like so:

<td>{{ humanDate solution.updatedAt }}</td>

This is what the helper file looks like. It can be found in myapp/app/helpers/human-date.js

import Ember from 'ember';
import moment from 'moment';

export function humanDate(params) {
  let datetime = params[0];

  if (datetime) {
    return moment(datetime).format('LL');
  } else {
    return '';
  }
}

export default Ember.Helper.helper(humanDate);

We were running 2.10.0-beta1. I just upgraded the app to 2.11.0 hoping that would fix the issue, but it didn’t. We’ve been tinkering away for the last 3-4 hours and I figure now is about time to ask for help.

Any help would be appreciated!

Thanks!


#2

Hi @johnnyicon, helper names need to be dasherized in the template! This should work:

<td>{{human-date solution.updatedAt}}</td>

#3

We’re now getting this…

rollbar.js:20 DEPRECATION: When calling `Ember.deprecate` you must provide an `options` hash as the third parameter.  `options` should include `id` and `until` properties. [deprecation id: ember-debug.deprecate-options-missing] See http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options for more details.
        at logDeprecationStackTrace (http://localhost:4200/assets/vendor.js:21055:19)
        at HANDLERS.(anonymous function) (http://localhost:4200/assets/vendor.js:21166:7)
        at raiseOnDeprecation (http://localhost:4200/assets/vendor.js:21085:12)
        at HANDLERS.(anonymous function) (http://localhost:4200/assets/vendor.js:21166:7)
        at invoke (http://localhost:4200/assets/vendor.js:21182:7)
        at deprecate (http://localhost:4200/assets/vendor.js:21150:32)
        at deprecate (http://localhost:4200/assets/vendor.js:21127:7)
        at Object.deprecate (http://localhost:4200/assets/vendor.js:32913:37)
        at deprecate (http://localhost:4200/assets/vendor.js:83446:40)

Which is followed by:

Uncaught RangeError: Maximum call stack size exceeded
    at RegExp.[Symbol.replace] (native)
    at String.replace (native)
    at logDeprecationStackTrace (http://localhost:4200/assets/vendor.js:21065:31)
    at HANDLERS.(anonymous function) (http://localhost:4200/assets/vendor.js:21166:7)
    at raiseOnDeprecation (http://localhost:4200/assets/vendor.js:21085:12)
    at HANDLERS.(anonymous function) (http://localhost:4200/assets/vendor.js:21166:7)
    at invoke (http://localhost:4200/assets/vendor.js:21182:7)
    at deprecate (http://localhost:4200/assets/vendor.js:21150:32)
    at deprecate (http://localhost:4200/assets/vendor.js:21127:7)
    at Object.deprecate (http://localhost:4200/assets/vendor.js:32913:37)

it appears that deprecation warning was called almost 3000 times!